package com.eduadmin.controller;

import com.alibaba.excel.EasyExcel;
import com.eduadmin.entity.*;
import com.eduadmin.exception.CustomException;
import com.eduadmin.listener.ScoreDataUploadListener;
import com.eduadmin.service.*;
import com.eduadmin.utils.ExcelUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;

@Controller
public class ScoreController {
    //构造函数自动装配
    private final IScoreService scoreService;
    private final IStudentService studentService;
    private final IStatisticsFinishedService statisticsFinishedService;//zlc 添加
    private final IExamService examService;
    private final ITeachInfoService teachInfoService;
    private final ITeacherService teacherService;
    private final IGradeService gradeService;
    private final ISingleMaxService singleMaxService;
    private final IStatisticsService statisticsService;
    private final IStatisticsParamiterService statisticsParamiterService;
    private final ITeamService teamService;
    private final IPassInformService passInformService;
    private final ITeamCourseAveService teamCourseAveService;
    private final ITeamCourseMedianService teamCourseMedianService;
    private final ITeamCourseRateService teamCourseRateService;
    private final ITotalDivideService totalDivideService;
    private final ICourseDivideService courseDivideService;
    @Autowired
    public ScoreController(IStatisticsFinishedService statisticsFinishedService,
                           IScoreService scoreService,
                           IStudentService studentService,
                           ITeacherService teacherService,
                           IExamService examService,
                           ITeachInfoService teachInfoService,
                           IGradeService gradeService,
                           ISingleMaxService singleMaxService,
                           IStatisticsService statisticsService,
                           IStatisticsParamiterService statisticsParamiterService,
                           ITeamService teamService,
                           IPassInformService passInformService,
                           ITeamCourseAveService teamCourseAveService,
                           ITeamCourseMedianService teamCourseMedianService,
                           ITeamCourseRateService teamCourseRateService,
                           ITotalDivideService totalDivideService,
                           ICourseDivideService courseDivideService){
        this.scoreService= scoreService;
        this.studentService= studentService;
        this.teacherService = teacherService;
        //zlc 添加
        this.statisticsFinishedService=statisticsFinishedService;
        this.examService=examService;
        this.teachInfoService=teachInfoService;
        this.gradeService=gradeService;
        this.singleMaxService=singleMaxService;
        this.statisticsService=statisticsService;
        this.statisticsParamiterService=statisticsParamiterService;
        this.teamService=teamService;
        this.passInformService=passInformService;
        this.teamCourseAveService=teamCourseAveService;
        this.teamCourseMedianService=teamCourseMedianService;
        this.teamCourseRateService=teamCourseRateService;
        this.totalDivideService=totalDivideService;
        this.courseDivideService=courseDivideService;
    }
    //hgm 导入数据
    @RequestMapping(value = "addScores")
    public String addScores(MultipartFile scoresFile,String gradeDatatableName,String gradeName) throws IOException {
        if(gradeDatatableName.equals(" ")){
            throw new CustomException("/adminindex","请选择导入成绩的年级！！",null);
        }
        EasyExcel.read(scoresFile.getInputStream(), Score.class, new ScoreDataUploadListener(studentService,scoreService,gradeDatatableName,gradeName)).sheet().doRead();
        return "uploaddataresult";
    }
    //导出查询的学生成绩
    @RequestMapping(value = "exportStudentScore")
    public void exportStudentScore(
            @RequestParam(value = "gradeName", required = false, defaultValue = "") String gradeName,
            @RequestParam(value = "gradeDatatableName", required = true, defaultValue = "t_score") String gradeDatatableName,
            @RequestParam(value = "teamName", required = false, defaultValue = " ") String teamName,
            @RequestParam(value = "semesterName", required = false, defaultValue = "") String semesterName,
            @RequestParam(value = "examName", required = false, defaultValue = "") String examName,
            @RequestParam(value = "studentName", required = false, defaultValue = "") String studentName,
            HttpServletResponse response
    ){
        //查询结果map
        Map<String, Object> paraMap = new HashMap<>();           //查询参数map
        paraMap.put("gradeName", gradeName);
        paraMap.put("gradeDatatableName", gradeDatatableName);  //要查询的年级数据库
        paraMap.put("teamName", teamName.length()<3 ? "": gradeName+teamName);                //年级名+班级名
        paraMap.put("semesterName", semesterName);
        paraMap.put("examName", examName);
        paraMap.put("studentName", studentName);

        List<Score> scores = scoreService.exportQueryStudentScores(paraMap);
        try {
            ExcelUtils.export2Web(response, gradeName+teamName+semesterName+examName+studentName, "score", Score.class, scores);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
    //新增成绩
    @RequestMapping(value = "newAddStudentScore")
    @ResponseBody
    public Map<String, String> newAddStudentScore(Score score, HttpServletRequest request) {
        Map<String, String> ret = new HashMap<>();
        Map<String, Object> maps = new HashMap<>();
        List<Score> scores = new ArrayList<>();
        score.setTeamName(score.getGradeName()+score.getTeamName());    //设置完整的班级名称 年级名称+班级名称
        float total =score.getChemistry()+score.getBiology()+score.getChinese()+score.getEnglish()+score.getGeography()+
                score.getHistory()+score.getMaths()+score.getSports()+score.getPhysics()+score.getPolitics();
        score.setTotal(total);  //计算总分
        //年级名称对应的数据库表名
        String gradeDatatableName = gradeService.getGradeByGradeName(score.getGradeName()).getGradeDatatableName();

        maps.put("gradeDatatableName", gradeDatatableName);
        maps.put("gradeName", score.getGradeName());
        maps.put("teamName", score.getTeamName());
        maps.put("semesterName", score.getSemesterName());
        maps.put("examName", score.getExamName());
        maps.put("studentIdCard", score.getStudentIdCard());
        //判断身份证号是否在学生表中
        Student student = studentService.getStudentByIdcard(score.getStudentIdCard());
        if (student != null ) {
            //判断成绩唯一
            if(scoreService.getScoreUnique(maps) == null){
                scores.add(score);
                maps.clear();
                maps.put("gradeDatatableName",gradeDatatableName);
                maps.put("scores",scores);
                scoreService.addScores(maps);
                ret.put("type", "success");
                ret.put("msg", "增加成功！");
            }else{
                ret.put("type", "error");
                ret.put("msg", "增加失败，该学生该次成绩已经在数据库中！");
            }
        } else {
            ret.put("type", "error");
            ret.put("msg", "增加失败，学生身份证号没有在学生库中！");
        }
        return ret;
    }
    //编辑学生成绩
    @RequestMapping(value = "editStudentScore")
    @ResponseBody
    public Map<String, String> editStudentScore(Score score, HttpServletRequest request) {
        Map<String, String> ret = new HashMap<>();
        Map<String, Object> maps = new HashMap<>();
        List<Score> scores = new ArrayList<>();
        String teamName = score.getTeamName();
        score.setTeamName(teamName.length() > 3 ? teamName : score.getGradeName()+ teamName);    //设置完整的班级名称 年级名称+班级名称
        float total =score.getChemistry()+score.getBiology()+score.getChinese()+score.getEnglish()+score.getGeography()+
                score.getHistory()+score.getMaths()+score.getSports()+score.getPhysics()+score.getPolitics();
        score.setTotal(total);  //计算总分
        //年级名称对应的数据库表名
        String gradeDatatableName = gradeService.getGradeByGradeName(score.getGradeName()).getGradeDatatableName();

        maps.put("gradeDatatableName", gradeDatatableName);
        maps.put("gradeName", score.getGradeName());
        maps.put("teamName", teamName);
        maps.put("semesterName", score.getSemesterName());
        maps.put("examName", score.getExamName());
        maps.put("studentIdCard", score.getStudentIdCard());
        //判断身份证号是否在学生表中

        Student student = studentService.getStudentByIdcard(score.getStudentIdCard());
        if (student != null ) {
            scores.add(score);
            maps.put("scores",scores);
            //判断成绩唯一
            if(scoreService.getScoreUnique(maps) == null){
                scoreService.addScores(maps);
                ret.put("type", "success");
                ret.put("msg", "增加成功！");
            }else{
                scoreService.updateStudentScore(maps);
                ret.put("type", "success");
                ret.put("msg", "更新成功！");
            }
        } else {
            ret.put("type", "error");
            ret.put("msg", "编辑失败，学生身份证号没有在学生库中！");
        }
        return ret;
    }
    //删除学生成绩
    @RequestMapping(value = "deleteStudentScore")
    @ResponseBody
    public Map<String, String> deleteStudentScore(@RequestParam(value = "ids[]") String[] ids) {
        Map<String, String> ret = new HashMap<>();
        String[] tempArray;
        StringBuffer sb = new StringBuffer();
        String gradeName="";
        for (int i = 0; i < ids.length; i++) {
           tempArray = ids[i].split("-");
           gradeName = tempArray[1];
          sb.append(tempArray[0]).append(',');
        }
        String gradeDatatableName= gradeService.getGradeByGradeName(gradeName).getGradeDatatableName();
        String idString = sb.toString().substring(0,sb.length()-1);
        Map<String,String> maps = new HashMap<>();
        maps.put("gradeDatatableName",gradeDatatableName);
        maps.put("idString",idString);

        long n = scoreService.deleteStudentScore(maps);
        if (n != 0) {
            ret.put("type", "success");
            ret.put("msg", "删除成功！");
            return ret;
        }
        ret.put("type", "error");
        ret.put("msg", "删除失败！");
        return ret;
    }

    //hgm 查询学生详细成绩
    @RequestMapping(value = "queryStudentDetailScore")
    @ResponseBody
    public Map<String,Object> queryDetailScore(
            @RequestParam(value = "page", required = false) String page,
            @RequestParam(value = "rows", required = false) String rows,
            @RequestParam(value = "gradeName", required = false, defaultValue = "") String gradeName,
            //默认值t_score 库中保留空表 避免首次进入没有选择年级而报错
            @RequestParam(value = "gradeDatatableName", required = false, defaultValue = "t_score") String gradeDatatableName,
            @RequestParam(value = "teamName", required = false, defaultValue = "") String teamName,
            @RequestParam(value = "semesterName", required = false, defaultValue = "") String semesterName,
            @RequestParam(value = "examName", required = false, defaultValue = "") String examName,
            @RequestParam(value = "studentName", required = false, defaultValue = "") String studentName
    ){
        Page pageBean = new Page(Integer.parseInt(page), Integer.parseInt(rows));
        Map<String, Object> reMap = new HashMap<>();                 //查询结果map
        Map<String, Object> paraMap = new HashMap<>();           //查询参数map
        paraMap.put("offset", pageBean.getOffset());
        paraMap.put("rows", pageBean.getRows());
        paraMap.put("gradeName", gradeName);
        paraMap.put("gradeDatatableName", gradeDatatableName);  //要查询的年级数据库
        paraMap.put("teamName", teamName.length()<3 ? "": gradeName+teamName);                //年级名+班级名
        paraMap.put("semesterName", semesterName);
        paraMap.put("examName", examName);
        paraMap.put("studentName", studentName);

        List<Score> scores = scoreService.getAllScores(paraMap);
        Long total = scoreService.getAllScoreTotal(paraMap);
        reMap.put("rows", scores);
        reMap.put("total", total);

        return reMap;
    }
    // 学生：查询自己的考试成绩  方法：通过学生的身份证号，从所有的年级成绩表中获取到学生的考试成绩列表
    @RequestMapping("queryStudentOwnScore")
    @ResponseBody
    public Map<String,Object> queryStudentOwnScore(
            @RequestParam(value = "page", required = false) String page,
            @RequestParam(value = "rows", required = false) String rows,
            @RequestParam("studentIdCard") String studentIdCard){

        Page pageBean = new Page(Integer.parseInt(page), Integer.parseInt(rows));
        Map<String, Object> reMap = new HashMap<>();              //查询结果map
        Map<String, Object> paraMap = new HashMap<>();           //查询参数map
        paraMap.put("offset", pageBean.getOffset());
        paraMap.put("rows", pageBean.getRows());
        paraMap.put("studentIdCard", studentIdCard);

         List<Grade> grades=gradeService.getAllGrades();//获得所有的年级信息
         // 遍历所有的年级对象
         List<Score> scores=new ArrayList<>();
         for (int i=0;i<grades.size();i++){
            String tGradeDatatableName=grades.get(i).getGradeDatatableName();
            paraMap.put("gradeDatatableName",tGradeDatatableName);
            List<Score> tScores=scoreService.getStudentOwnScoreByParam(paraMap);// 通过参数（年级数据库名称,学生身份证号）查找所有的记录
            for (int j=0;j<tScores.size();j++){
                scores.add(tScores.get(j));
            }
         }
         int total = scores.size();
         reMap.put("rows", scores);
         reMap.put("total", total);
         return reMap;
    }
    // 管理员：传递参数进行统计
    @PostMapping(value = "scoreStatistics")
    @ResponseBody
    public Map<String,Object> scoreStatistics(
                               @RequestParam("statisticsTableName") String statisticsTableName,
                               @RequestParam("gradeDatatableName") String gradeDatatableName,
                               @RequestParam("semesterName") String semesterName,
                               @RequestParam("examName") String examName,
                               @RequestParam("categoryName") String categoryName
    ){
        Map<String,Object> res=new HashMap<>(); //返回Map对象
        Map<String,Object> paraMap=new HashMap<>(); //参数Map对象
        paraMap.put("statisticsTableName",statisticsTableName);
        paraMap.put("gradeDatatableName",gradeDatatableName);
        paraMap.put("semesterName",semesterName);
        paraMap.put("examName",examName);
        paraMap.put("categoryName",categoryName);
        if (statisticsFinishedService.isHaveStatistics(paraMap)>0){
            res.put("success","success");
            res.put("msg","已经统计过,不用重复统计");
            return res;
        }
        else {
        // begin of 公共部分"：
            // 获取满足参数条件的学生成绩记录列表（成绩列表按总分“从高到低”排序返回）
            List<Score> scoreList = scoreService.getAllScoreByParam(gradeDatatableName, semesterName, examName, categoryName);

            // 根据年级成绩表的名称（gradeDatatableName）在年级表中查询年级名称。
            List<Grade> gradeList = gradeService.getGradeNameByParam(gradeDatatableName);
            String gradeName = gradeList.get(0).getGradeName();

            // 通过获得的成绩列表scoreList，筛选出所有的班级名称存入teamList中。
            List<String> teamList=new ArrayList<>();
            for (int i=0;i<scoreList.size();i++)
            {
                String tTeamName=scoreList.get(i).getTeamName();
                if (teamList.size()==0) teamList.add(tTeamName);
                else {
                    boolean tag=true;
                    for (int j=0;j<teamList.size();j++)
                        if (tTeamName.equals(teamList.get(j))){tag=false;break;}
                    if (tag) teamList.add(tTeamName);
                }
            }
            // 根据(年级名称，学期名称，考试名称）获取本次考试的学科英文名称信息
            Map<String,Object> paraMapForExam=new HashMap<>();
            paraMapForExam.put("gradeName",gradeName);
            paraMapForExam.put("semesterName",semesterName);
            paraMapForExam.put("examName",examName);
            Exam exam = examService.getExamByParams(paraMapForExam);
            //生成学科英文名称数组
            String examCourseArr[] = exam.getCourseName().split("\\|");

            // 获取统计参数
            StatisticsParamiter statisticsParamiter=statisticsParamiterService.getStatisticsParamiterByParams(semesterName,gradeName,examName,categoryName);
       // end of "公共部分"
            if (scoreList.size()>0&&statisticsParamiter!=null){ // 查找到学生成绩列表，进行统计
                // 根据“报表名称”分类统计：
                switch (statisticsTableName) {
                case "t_single_max": {
                    // 分学科查找最高分，生成单科最高分列表：（核心）
                    List<SingleMax> singleMaxList=new ArrayList<>();
                    for (int i=0;i<examCourseArr.length;i++) {
                        SingleMax singleMax=new SingleMax();
                        singleMax.setSemesterName(semesterName);
                        singleMax.setGradeName(gradeName);
                        singleMax.setExamName(examName);
                        singleMax.setCategoryName(categoryName);
                        // 中文名称
                        String chName="";
                        switch (examCourseArr[i]){
                            case "chinese":{chName="语文";break;}
                            case "maths":{chName="数学";break;}
                            case "english":{chName="英语";break;}
                            case "physics":{chName="物理";break;}
                            case "history":{chName="历史";break;}
                            case "chemistry":{chName="化学";break;}
                            case "biology":{chName="生物";break;}
                            case "politics":{chName="政治";break;}
                            case "geography":{chName="地理";break;}
                            case "sports":{chName="体育";break;}
                        }
                        singleMax.setCourseEnName(examCourseArr[i]); //存入学科英文名称
                        singleMax.setCourseChName(chName); //存入学科中文名称
                        float tMax=0; //临时变量
                        switch (examCourseArr[i]) {
                        case "chinese": { //找“语文”学科的单科最高分及对应的学生名字，所在班级，任课教师名字。
                        for (int s=0;s<scoreList.size();s++) {
                            float tScore=0;
                            if (scoreList.get(s).getChinese()>0) tScore=scoreList.get(s).getChinese();// 当前记录的成绩
                            String tStudentName=scoreList.get(s).getStudentName();//当前记录的学生名字
                            String tTeamName=scoreList.get(s).getTeamName();//当前记录的班级名称
                            if (tScore>0) {
                                if (tMax<tScore)
                                {
                                    tMax=tScore;
                                    singleMax.setStudentNames(tStudentName); //存入学生名
                                    singleMax.setTeamNames(tTeamName); //存入班级名
                                } else if (tMax==tScore){//最高分有多个学生成绩相同
                                    tStudentName=singleMax.getStudentNames()+"|"+tStudentName; //用"|"分隔
                                    singleMax.setStudentNames(tStudentName);//存入学生名
                                    tTeamName=singleMax.getTeamNames()+"|"+tTeamName;
                                    singleMax.setTeamNames(tTeamName);//存入班级名
                                }
                            }
                        }
                        singleMax.setResult(tMax);//存入最高成绩

                        // 此处查找教师的姓名,可能涉及多名教师。
                        String tTeamName[]={};
                        if (singleMax.getTeamNames()!=null) tTeamName=singleMax.getTeamNames().split("\\|");
                        String tTeacherName="";
                        for (int j=0;j<tTeamName.length;j++){
                            List<TeachInfo> teachInfoList=teachInfoService.getTeacherNameByParam(
                                    semesterName,gradeName,tTeamName[j],singleMax.getCourseEnName());
                            String teacherName="";
                            if (teachInfoList.size()>0){
                                teacherName=teachInfoList.get(0).getTeacherName();
                            }
                            if (j>0){
                                tTeacherName=tTeacherName+"|"+teacherName;
                            }
                            else {
                                tTeacherName+=teacherName;
                            }
                        }
                        singleMax.setTeacherNames(tTeacherName);//存入教师姓名
                        singleMaxList.add(singleMax);//加入列表
                        break;}//测试通过  注意：班级名称是“初2024级01班”，不是“初2024级1班”
                        case "maths":{ //找“数学”学科的单科最高分及对应的学生名字，所在班级，任课教师名字。
                        for (int s=0;s<scoreList.size();s++) {
                            float  tScore=0;
                            if (scoreList.get(s).getMaths()>0) tScore=scoreList.get(s).getMaths();// 当前记录的成绩
                            String tStudentName=scoreList.get(s).getStudentName();//当前记录的学生名字
                            String tTeamName=scoreList.get(s).getTeamName();//当前记录的班级名称
                            if (tScore>0 ) {
                                if (tMax<tScore)
                                {
                                    tMax=tScore;
                                    singleMax.setStudentNames(tStudentName);
                                    singleMax.setTeamNames(tTeamName); //存入班级名称
                                } else if (tMax==tScore){//最高分有多个学生成绩相同
                                    tStudentName=singleMax.getStudentNames()+"|"+tStudentName; //用"|"分隔
                                    singleMax.setStudentNames(tStudentName);
                                    tTeamName=singleMax.getTeamNames()+"|"+tTeamName;
                                    singleMax.setTeamNames(tTeamName); //存入班级名称
                                }
                            }
                        }
                        singleMax.setResult(tMax);//存入最高成绩
                        // 此处查找教师的姓名,可能涉及多名教师。
                        String tTeamName[]={};
                        if (singleMax.getTeamNames()!=null) tTeamName=singleMax.getTeamNames().split("\\|");
                        String tTeacherName="";
                        for (int j=0;j<tTeamName.length;j++){
                            List<TeachInfo> teachInfoList=teachInfoService.getTeacherNameByParam(
                                    semesterName,gradeName,tTeamName[j],singleMax.getCourseEnName());
                            String teacherName="";
                            if (teachInfoList.size()>0){
                                teacherName=teachInfoList.get(0).getTeacherName();
                            }
                            if (j>0){
                                tTeacherName=tTeacherName+"|"+teacherName;
                            }
                            else {
                                tTeacherName+=teacherName;
                            }
                        }
                        singleMax.setTeacherNames(tTeacherName);//存入教师姓名
                        singleMaxList.add(singleMax);//加入列表
                        break;}
                        case "english":{ //找“英语”学科的单科最高分及对应的学生名字，所在班级，任课教师名字。
                        for (int s=0;s<scoreList.size();s++) {
                            float  tScore=0;
                            if (scoreList.get(s).getEnglish()>0) tScore=scoreList.get(s).getEnglish();// 当前记录的成绩
                            String tStudentName=scoreList.get(s).getStudentName();//当前记录的学生名字
                            String tTeamName=scoreList.get(s).getTeamName();//当前记录的班级名称
                            if (tScore>0 ) {
                                if (tMax<tScore)
                                {
                                    tMax=tScore;
                                    singleMax.setStudentNames(tStudentName); //存入学生名称
                                    singleMax.setTeamNames(tTeamName);
                                } else if (tMax==tScore){//最高分有多个学生成绩相同
                                    tStudentName=singleMax.getStudentNames()+"|"+tStudentName; //用"|"分隔
                                    singleMax.setStudentNames(tStudentName);
                                    tTeamName=singleMax.getTeamNames()+"|"+tTeamName;
                                    singleMax.setTeamNames(tTeamName);//存入班级级名称
                                }
                            }
                        }
                        singleMax.setResult(tMax);//存入最高成绩
                        // 此处查找教师的姓名,可能涉及多名教师。
                        String tTeamName[]={};
                        if (singleMax.getTeamNames()!=null) tTeamName=singleMax.getTeamNames().split("\\|");
                        String tTeacherName="";
                        for (int j=0;j<tTeamName.length;j++){
                            List<TeachInfo> teachInfoList=teachInfoService.getTeacherNameByParam(
                                    semesterName,gradeName,tTeamName[j],singleMax.getCourseEnName());
                            String teacherName="";
                            if (teachInfoList.size()>0){
                                teacherName=teachInfoList.get(0).getTeacherName();
                            }
                            if (j>0){
                                tTeacherName=tTeacherName+"|"+teacherName;
                            }
                            else {
                                tTeacherName+=teacherName;
                            }
                        }
                        singleMax.setTeacherNames(tTeacherName);//存入教师姓名
                        singleMaxList.add(singleMax);//加入列表
                        break;}
                        case "physics":{ //找“物理”学科的单科最高分及对应的学生名字，所在班级，任课教师名字。
                        for (int s=0;s<scoreList.size();s++) {
                            float  tScore=0;
                            if (scoreList.get(s).getPhysics()>0) tScore=scoreList.get(s).getPhysics();// 当前记录的成绩
                            String tStudentName=scoreList.get(s).getStudentName();//当前记录的学生名字
                            String tTeamName=scoreList.get(s).getTeamName();//当前记录的班级名称
                            if (tScore>0) {
                                if (tMax<tScore)
                                {
                                    tMax=tScore;
                                    singleMax.setStudentNames(tStudentName);
                                    singleMax.setTeamNames(tTeamName);
                                } else if (tMax==tScore){//最高分有多个学生成绩相同
                                    tStudentName=singleMax.getStudentNames()+"|"+tStudentName; //用"|"分隔
                                    singleMax.setStudentNames(tStudentName);
                                    tTeamName=singleMax.getTeamNames()+"|"+tTeamName;
                                    singleMax.setTeamNames(tTeamName);
                                }
                            }
                        }
                        singleMax.setResult(tMax);//存入最高成绩
                        // 此处查找教师的姓名,可能涉及多名教师。
                        String tTeamName[]={};
                        if (singleMax.getTeamNames()!=null) tTeamName=singleMax.getTeamNames().split("\\|");
                        String tTeacherName="";
                        for (int j=0;j<tTeamName.length;j++){
                            List<TeachInfo> teachInfoList=teachInfoService.getTeacherNameByParam(
                                    semesterName,gradeName,tTeamName[j],singleMax.getCourseEnName());
                            String teacherName="";
                            if (teachInfoList.size()>0){
                                teacherName=teachInfoList.get(0).getTeacherName();
                            }
                            if (j>0){
                                tTeacherName=tTeacherName+"|"+teacherName;
                            }
                            else {
                                tTeacherName+=teacherName;
                            }
                        }
                        singleMax.setTeacherNames(tTeacherName);//存入教师姓名
                        singleMaxList.add(singleMax);//加入列表
                        break;}
                        case "history":{ //找“历史”学科的单科最高分及对应的学生名字，所在班级，任课教师名字。
                        for (int s=0;s<scoreList.size();s++) {
                            float  tScore=0;
                            if (scoreList.get(s).getHistory()>0) tScore=scoreList.get(s).getHistory();// 当前记录的成绩
                            String tStudentName=scoreList.get(s).getStudentName();//当前记录的学生名
                            String tTeamName=scoreList.get(s).getTeamName();//当前记录的班级名称
                            if (tScore>0 ) {
                                if (tMax<tScore)
                                {
                                    tMax=tScore;
                                    singleMax.setStudentNames(tStudentName);
                                    singleMax.setTeamNames(tTeamName);
                                } else if (tMax==tScore){//最高分有多个学生成绩相同
                                    tStudentName=singleMax.getStudentNames()+"|"+tStudentName; //用"|"分隔
                                    singleMax.setStudentNames(tStudentName);
                                    tTeamName=singleMax.getTeamNames()+"|"+tTeamName;
                                    singleMax.setTeamNames(tTeamName);
                                }
                            }
                        }
                        singleMax.setResult(tMax);//存入最高成绩
                        // 此处查找教师的姓名,可能涉及多名教师。
                        String tTeamName[]={};
                        if (singleMax.getTeamNames()!=null) tTeamName=singleMax.getTeamNames().split("\\|");
                        String tTeacherName="";
                        for (int j=0;j<tTeamName.length;j++){
                            List<TeachInfo> teachInfoList=teachInfoService.getTeacherNameByParam(
                                    semesterName,gradeName,tTeamName[j],singleMax.getCourseEnName());
                            String teacherName="";
                            if (teachInfoList.size()>0){
                                teacherName=teachInfoList.get(0).getTeacherName();
                            }
                            if (j>0){
                                tTeacherName=tTeacherName+"|"+teacherName;
                            }
                            else {
                                tTeacherName+=teacherName;
                            }
                        }
                        singleMax.setTeacherNames(tTeacherName);//存入教师姓名
                        singleMaxList.add(singleMax);//加入列表
                        break;}
                        case "chemistry":{ //找“化学”学科的单科最高分及对应的学生名字，所在班级，任课教师名字。
                        for (int s=0;s<scoreList.size();s++) {
                            float tScore=0;
                            if (scoreList.get(s).getChemistry()>0) tScore=scoreList.get(s).getChemistry();// 当前记录的成绩
                            String tStudentName=scoreList.get(s).getStudentName();//当前记录的学生名
                            String tTeamName=scoreList.get(s).getTeamName();//当前记录的班级名称
                            if (tScore>0 ) {
                                if (tMax<tScore)
                                {
                                    tMax=tScore;
                                    singleMax.setStudentNames(tStudentName);
                                    singleMax.setTeamNames(tTeamName);
                                } else if (tMax==tScore){//最高分有多个学生成绩相同
                                    tStudentName=singleMax.getStudentNames()+"|"+tStudentName; //用"|"分隔
                                    singleMax.setStudentNames(tStudentName);
                                    tTeamName=singleMax.getTeamNames()+"|"+tTeamName;
                                    singleMax.setTeamNames(tTeamName);
                                }
                            }
                        }
                        singleMax.setResult(tMax);//存入最高成绩
                        // 此处查找教师的姓名,可能涉及多名教师。
                        String tTeamName[]={};
                        if (singleMax.getTeamNames()!=null) tTeamName=singleMax.getTeamNames().split("\\|");
                        String tTeacherName="";
                        for (int j=0;j<tTeamName.length;j++){
                            List<TeachInfo> teachInfoList=teachInfoService.getTeacherNameByParam(
                                    semesterName,gradeName,tTeamName[j],singleMax.getCourseEnName());
                            String teacherName="";
                            if (teachInfoList.size()>0){
                                teacherName=teachInfoList.get(0).getTeacherName();
                            }
                            if (j>0){
                                tTeacherName=tTeacherName+"|"+teacherName;
                            }
                            else {
                                tTeacherName+=teacherName;
                            }
                        }
                        singleMax.setTeacherNames(tTeacherName);//存入教师姓名
                        singleMaxList.add(singleMax);//加入列表
                        break;}
                        case "biology":{ //找“生物”学科的单科最高分及对应的学生名字，所在班级，任课教师名字。
                        for (int s=0;s<scoreList.size();s++) {
                            float  tScore=0;
                            if (scoreList.get(s).getBiology()>0) tScore=scoreList.get(s).getBiology();// 当前记录的成绩
                            String tStudentName=scoreList.get(s).getStudentName();//当前记录的学生名
                            String tTeamName=scoreList.get(s).getTeamName();//当前记录的班级名称
                            if (tScore>0 ) {
                                if (tMax<tScore)
                                {
                                    tMax=tScore;
                                    singleMax.setStudentNames(tStudentName);
                                    singleMax.setTeamNames(tTeamName);
                                } else if (tMax==tScore){//最高分有多个学生成绩相同
                                    tStudentName=singleMax.getStudentNames()+"|"+tStudentName; //用"|"分隔
                                    singleMax.setStudentNames(tStudentName);
                                    tTeamName=singleMax.getTeamNames()+"|"+tTeamName;
                                    singleMax.setTeamNames(tTeamName);
                                }
                            }
                        }
                        singleMax.setResult(tMax);//存入最高成绩
                        // 此处查找教师的姓名,可能涉及多名教师。
                        String tTeamName[]={};
                        if (singleMax.getTeamNames()!=null) tTeamName=singleMax.getTeamNames().split("\\|");
                        String tTeacherName="";
                        for (int j=0;j<tTeamName.length;j++){
                            List<TeachInfo> teachInfoList=teachInfoService.getTeacherNameByParam(
                                    semesterName,gradeName,tTeamName[j],singleMax.getCourseEnName());
                            String teacherName="";
                            if (teachInfoList.size()>0){
                                teacherName=teachInfoList.get(0).getTeacherName();
                            }
                            if (j>0){
                                tTeacherName=tTeacherName+"|"+teacherName;
                            }
                            else {
                                tTeacherName+=teacherName;
                            }
                        }
                        singleMax.setTeacherNames(tTeacherName);//存入教师姓名
                        singleMaxList.add(singleMax);//加入列表
                        break;}
                        case "politics":{ //找“政治”学科的单科最高分及对应的学生名字，所在班级，任课教师名字。
                        for (int s=0;s<scoreList.size();s++) {
                            float  tScore=0;
                            if (scoreList.get(s).getPolitics()>0) tScore=scoreList.get(s).getPolitics();// 当前记录的成绩
                            String tStudentName=scoreList.get(s).getStudentName();//当前记录的学生名
                            String tTeamName=scoreList.get(s).getTeamName();//当前记录的班级名称
                            if (tScore>0 ) {
                                if (tMax<tScore)
                                {
                                    tMax=tScore;
                                    singleMax.setStudentNames(tStudentName);
                                    singleMax.setTeamNames(tTeamName);
                                } else if (tMax==tScore){//最高分有多个学生成绩相同
                                    tStudentName=singleMax.getStudentNames()+"|"+tStudentName; //用"|"分隔
                                    singleMax.setStudentNames(tStudentName);
                                    tTeamName=singleMax.getTeamNames()+"|"+tTeamName;
                                    singleMax.setTeamNames(tTeamName);
                                }
                            }
                        }
                        singleMax.setResult(tMax);//存入最高成绩
                        // 此处查找教师的姓名,可能涉及多名教师。
                        String tTeamName[]={};
                        if (singleMax.getTeamNames()!=null) tTeamName=singleMax.getTeamNames().split("\\|");
                        String tTeacherName="";
                        for (int j=0;j<tTeamName.length;j++){
                            List<TeachInfo> teachInfoList=teachInfoService.getTeacherNameByParam(
                                    semesterName,gradeName,tTeamName[j],singleMax.getCourseEnName());
                            String teacherName="";
                            if (teachInfoList.size()>0){
                                teacherName=teachInfoList.get(0).getTeacherName();
                            }
                            if (j>0){
                                tTeacherName=tTeacherName+"|"+teacherName;
                            }
                            else {
                                tTeacherName+=teacherName;
                            }
                        }
                        singleMax.setTeacherNames(tTeacherName);//存入教师姓名
                        singleMaxList.add(singleMax);//加入列表
                        break;}
                        case "geography":{ //找“地理”学科的单科最高分及对应的学生名字，所在班级，任课教师名字。
                        for (int s=0;s<scoreList.size();s++) {
                            float  tScore=0;
                            if (scoreList.get(s).getGeography()>0) tScore=scoreList.get(s).getGeography();// 当前记录的成绩
                            String tStudentName=scoreList.get(s).getStudentName();//当前记录的学生名
                            String tTeamName=scoreList.get(s).getTeamName();//当前记录的班级名称
                            if (tScore>0 ) {
                                if (tMax<tScore)
                                {
                                    tMax=tScore;
                                    singleMax.setStudentNames(tStudentName);
                                    singleMax.setTeamNames(tTeamName);
                                } else if (tMax==tScore){//最高分有多个学生成绩相同
                                    tStudentName=singleMax.getStudentNames()+"|"+tStudentName; //用"|"分隔
                                    singleMax.setStudentNames(tStudentName);
                                    tTeamName=singleMax.getTeamNames()+"|"+tTeamName;
                                    singleMax.setTeamNames(tTeamName);
                                }
                            }
                        }
                        singleMax.setResult(tMax);//存入最高成绩
                        // 此处查找教师的姓名,可能涉及多名教师。
                        String tTeamName[]={};
                        if (singleMax.getTeamNames()!=null) tTeamName=singleMax.getTeamNames().split("\\|");
                        String tTeacherName="";
                        for (int j=0;j<tTeamName.length;j++){
                            List<TeachInfo> teachInfoList=teachInfoService.getTeacherNameByParam(
                                    semesterName,gradeName,tTeamName[j],singleMax.getCourseEnName());
                            String teacherName="";
                            if (teachInfoList.size()>0){
                                teacherName=teachInfoList.get(0).getTeacherName();
                            }
                            if (j>0){
                                tTeacherName=tTeacherName+"|"+teacherName;
                            }
                            else {
                                tTeacherName+=teacherName;
                            }
                        }
                        singleMax.setTeacherNames(tTeacherName);//存入教师姓名
                        singleMaxList.add(singleMax);//加入列表
                        break;}
                        case "sports":{ //找“体育”学科的单科最高分及对应的学生名字，所在班级，任课教师名字。
                        for (int s=0;s<scoreList.size();s++) {
                            float  tScore=0;
                            if (scoreList.get(s).getSports()>0) tScore=scoreList.get(s).getSports();// 当前记录的成绩
                            String tStudentName=scoreList.get(s).getStudentName();//当前记录的学生名
                            String tTeamName=scoreList.get(s).getTeamName();//当前记录的班级名称
                            if (tScore>0 ) {
                                if (tMax<tScore)
                                {
                                    tMax=tScore;
                                    singleMax.setStudentNames(tStudentName);
                                    singleMax.setTeamNames(tTeamName);
                                } else if (tMax==tScore){//最高分有多个学生成绩相同
                                    tStudentName=singleMax.getStudentNames()+"|"+tStudentName; //用"|"分隔
                                    singleMax.setStudentNames(tStudentName);
                                    tTeamName=singleMax.getTeamNames()+"|"+tTeamName;
                                    singleMax.setTeamNames(tTeamName);
                                }
                            }
                        }
                        singleMax.setResult(tMax);//存入最高成绩
                        // 此处查找教师的姓名,可能涉及多名教师。
                        String tTeamName[]={};
                        if (singleMax.getTeamNames()!=null) tTeamName=singleMax.getTeamNames().split("\\|");
                        String tTeacherName="";
                        for (int j=0;j<tTeamName.length;j++){
                            List<TeachInfo> teachInfoList=teachInfoService.getTeacherNameByParam(
                                    semesterName,gradeName,tTeamName[j],singleMax.getCourseEnName());
                            String teacherName="";
                            if (teachInfoList.size()>0){
                                teacherName=teachInfoList.get(0).getTeacherName();
                            }
                            if (j>0){
                                tTeacherName=tTeacherName+"|"+teacherName;
                            }
                            else {
                                tTeacherName+=teacherName;
                            }
                        }
                        singleMax.setTeacherNames(tTeacherName);//存入教师姓名
                        singleMaxList.add(singleMax);//加入列表
                        break;}
                } // end for switch
                    }//end for 外层
                    // 统计结果列表批量存入t_single_max表。
                    singleMaxService.batchInsert(singleMaxList); // *测试成功*
                break;
                } // end of  “单科最高分表 t_single_max" *测试通过（利用了scoreList的结果）*
                case "t_pass_inform":{

                    float tOne=statisticsParamiter.getOneNumber();// 重点或联招线
                    float tTwo=statisticsParamiter.getTwoNumber(); // 一本或普高线

                    // 定义存放上线情况统计结果记录的列表
                    List<PassInform> passInformList=new ArrayList<>();
                    // 按照班级统计达到tOne的人数和达到tTwo的人数
                    for (int i=0;i<teamList.size();i++)
                    {
                        PassInform tPassInform=new PassInform();
                        String tTeamName=teamList.get(i);

                        tPassInform.setSemesterName(semesterName);
                        tPassInform.setGradeName(gradeName);
                        tPassInform.setExamName(examName);
                        tPassInform.setCategoryName(categoryName);
                        tPassInform.setTeamName(tTeamName);

                        Integer tOnePass=0,tTwoPass=0,tStudentNumber=0; //tStudentNumber：参考人数 tOnePass：一本或联招人数 tTwoPass：二本或普高人数
                        for (int j=0;j<scoreList.size();j++) {
                            if (tTeamName.equals(scoreList.get(j).getTeamName())) {//
                                tStudentNumber++; // 参考学生人数
                                if (scoreList.get(j).getTotal() >= tOne) tOnePass++;
                                if (scoreList.get(j).getTotal() >= tTwo) tTwoPass++;
                            }
                        }
                        tPassInform.setStudentNumber(tStudentNumber);
                        tPassInform.setOnePass(tOnePass);
                        tPassInform.setTwoPass(tTwoPass);
                        passInformList.add(tPassInform);
                    }
                    // 统计结果列表存入数据表t_pass_inform
                    passInformService.batchInsert(passInformList);
                    break;
                    } // end of “上线情况表 t_pass_inform” *测试通过（利用了scoreList的结果）*
                case "t_team_course_ave":{//统计“班级学科平均分表”
                    // 定义：存放班级学科平均分统计结果记录的列表
                    List<TeamCourseAve> teamCourseAveList=new ArrayList<>();
                    for (int i=0;i<teamList.size();i++){ // 遍历班级
                        TeamCourseAve teamCourseAve=new TeamCourseAve();
                        String tTeamName=teamList.get(i);

                        teamCourseAve.setSemesterName(semesterName);
                        teamCourseAve.setGradeName(gradeName);
                        teamCourseAve.setExamName(examName);
                        teamCourseAve.setCategoryName(categoryName);
                        teamCourseAve.setTeamName(tTeamName);
                        for (int j=0;j<examCourseArr.length;j++){ // 遍历学科（统计当前班级所有参考学科的平均分）
                            String tCourseName=examCourseArr[j];
                            switch(tCourseName){ //分学科统计
                                case "chinese":{
                                    Integer tStudentNumber=0;//参考学生人数
                                    float tCourseTotal=0; // 当前学科总分tCourseTotal
                                    for (int k=0;k<scoreList.size();k++){ // 遍历成绩NO.1
                                        if (tTeamName.equals(scoreList.get(k).getTeamName())){
                                            float t=0;
                                            if (scoreList.get(k).getChinese()>0) t=scoreList.get(k).getChinese();
                                            if (t>0){
                                                tStudentNumber++;
                                                tCourseTotal+=t;
                                            }
                                        }
                                    } // end of 遍历成绩NO.1
                                    // 当前学科平均分存入teamCourseAve
                                    float tCourseTotalVal=0;
                                    if (tStudentNumber>0){
                                        tCourseTotalVal=Float.parseFloat(String.format("%.2f",tCourseTotal/tStudentNumber));//保留两位小数
                                    }
                                    teamCourseAve.setChineseAve(tCourseTotalVal);
                                    break;
                                }
                                case "maths":{
                                    Integer tStudentNumber=0;//参考学生人数
                                    float tCourseTotal=0; // 当前学科总分tCourseTotal
                                    for (int k=0;k<scoreList.size();k++){ // 遍历成绩NO.2
                                        if (tTeamName.equals(scoreList.get(k).getTeamName())){
                                            float t=0;
                                            if (scoreList.get(k).getMaths()>0) t=scoreList.get(k).getMaths();
                                            if (t>0){
                                                tStudentNumber++;
                                                tCourseTotal+=t;
                                            }
                                        }
                                    } // end of 遍历成绩NO.2
                                    // 当前学科平均分存入teamCourseAve
                                    float tCourseTotalVal=0;
                                    if (tStudentNumber>0){
                                        tCourseTotalVal=Float.parseFloat(String.format("%.2f",tCourseTotal/tStudentNumber));//保留两位小数
                                    }
                                    teamCourseAve.setMathsAve(tCourseTotalVal);
                                    break;
                                }
                                case "english":{
                                    Integer tStudentNumber=0;//参考学生人数
                                    float tCourseTotal=0; // 当前学科总分tCourseTotal
                                    for (int k=0;k<scoreList.size();k++){ // 遍历成绩NO.3
                                        if (tTeamName.equals(scoreList.get(k).getTeamName())){
                                            float t=0;
                                            if (scoreList.get(k).getEnglish()>0) t=scoreList.get(k).getEnglish();
                                            if (t>0){
                                                tStudentNumber++;
                                                tCourseTotal+=t;
                                            }
                                        }
                                    } // end of 遍历成绩NO.3
                                    // 当前学科平均分存入teamCourseAve
                                    float tCourseTotalVal=0;
                                    if (tStudentNumber>0){
                                        tCourseTotalVal=Float.parseFloat(String.format("%.2f",tCourseTotal/tStudentNumber));//保留两位小数
                                    }
                                    teamCourseAve.setEnglishAve(tCourseTotalVal);
                                    break;
                                }
                                case "physics":{
                                    Integer tStudentNumber=0;//参考学生人数
                                    float tCourseTotal=0; // 当前学科总分tCourseTotal
                                    for (int k=0;k<scoreList.size();k++){ // 遍历成绩NO.4
                                        if (tTeamName.equals(scoreList.get(k).getTeamName())){
                                            float t=0;
                                            if (scoreList.get(k).getPhysics()>0) t=scoreList.get(k).getPhysics();
                                            if (t>0){
                                                tStudentNumber++;
                                                tCourseTotal+=t;
                                            }
                                        }
                                    } // end of 遍历成绩NO.4
                                    // 当前学科平均分存入teamCourseAve
                                    float tCourseTotalVal=0;
                                    if (tStudentNumber>0){
                                        tCourseTotalVal=Float.parseFloat(String.format("%.2f",tCourseTotal/tStudentNumber));//保留两位小数
                                    }
                                    teamCourseAve.setPhysicsAve(tCourseTotalVal);
                                    break;
                                }
                                case "history":{
                                    Integer tStudentNumber=0;//参考学生人数
                                    float tCourseTotal=0; // 当前学科总分tCourseTotal
                                    for (int k=0;k<scoreList.size();k++){ // 遍历成绩NO.5
                                        if (tTeamName.equals(scoreList.get(k).getTeamName())){
                                            float t=0;
                                            if (scoreList.get(k).getHistory()>0) t=scoreList.get(k).getHistory();
                                            if (t>0){
                                                tStudentNumber++;
                                                tCourseTotal+=t;
                                            }
                                        }
                                    } // end of 遍历成绩NO.5
                                    // 当前学科平均分存入teamCourseAve
                                    float tCourseTotalVal=0;
                                    if (tStudentNumber>0){
                                        tCourseTotalVal=Float.parseFloat(String.format("%.2f",tCourseTotal/tStudentNumber));//保留两位小数
                                    }
                                    teamCourseAve.setHistoryAve(tCourseTotalVal);
                                    break;
                                }
                                case "chemistry":{
                                    Integer tStudentNumber=0;//参考学生人数
                                    float tCourseTotal=0; // 当前学科总分tCourseTotal
                                    for (int k=0;k<scoreList.size();k++){ // 遍历成绩NO.6
                                        if (tTeamName.equals(scoreList.get(k).getTeamName())){
                                            float t=0;
                                            if (scoreList.get(k).getChemistry()>0) t=scoreList.get(k).getChemistry();
                                            if (t>0){
                                                tStudentNumber++;
                                                tCourseTotal+=t;
                                            }
                                        }
                                    } // end of 遍历成绩NO.6
                                    // 当前学科平均分存入teamCourseAve
                                    float tCourseTotalVal=0;
                                    if (tStudentNumber>0){
                                        tCourseTotalVal=Float.parseFloat(String.format("%.2f",tCourseTotal/tStudentNumber));//保留两位小数
                                    }
                                    teamCourseAve.setChemistryAve(tCourseTotalVal);
                                    break;
                                }
                                case "biology":{
                                    Integer tStudentNumber=0;//参考学生人数
                                    float tCourseTotal=0; // 当前学科总分tCourseTotal
                                    for (int k=0;k<scoreList.size();k++){ // 遍历成绩NO.7
                                        if (tTeamName.equals(scoreList.get(k).getTeamName())){
                                            float t=0;
                                            if (scoreList.get(k).getBiology()>0) t=scoreList.get(k).getBiology();
                                            if (t>0){
                                                tStudentNumber++;
                                                tCourseTotal+=t;
                                            }
                                        }
                                    } // end of 遍历成绩NO.7
                                    // 当前学科平均分存入teamCourseAve
                                    float tCourseTotalVal=0;
                                    if (tStudentNumber>0){
                                        tCourseTotalVal=Float.parseFloat(String.format("%.2f",tCourseTotal/tStudentNumber));//保留两位小数
                                    }
                                    teamCourseAve.setBiologyAve(tCourseTotalVal);
                                    break;
                                }
                                case "politics":{
                                    Integer tStudentNumber=0;//参考学生人数
                                    float tCourseTotal=0; // 当前学科总分tCourseTotal
                                    for (int k=0;k<scoreList.size();k++){ // 遍历成绩NO.8
                                        if (tTeamName.equals(scoreList.get(k).getTeamName())){
                                            float t=0;
                                            if (scoreList.get(k).getPolitics()>0) t=scoreList.get(k).getPolitics();
                                            if (t>0){
                                                tStudentNumber++;
                                                tCourseTotal+=t;
                                            }
                                        }
                                    } // end of 遍历成绩NO.1
                                    // 当前学科平均分存入teamCourseAve
                                    float tCourseTotalVal=0;
                                    if (tStudentNumber>0){
                                        tCourseTotalVal=Float.parseFloat(String.format("%.2f",tCourseTotal/tStudentNumber));//保留两位小数
                                    }
                                    teamCourseAve.setPoliticsAve(tCourseTotalVal);
                                    break;
                                }
                                case "geography":{
                                    Integer tStudentNumber=0;//参考学生人数
                                    float tCourseTotal=0; // 当前学科总分tCourseTotal
                                    for (int k=0;k<scoreList.size();k++){ // 遍历成绩NO.9
                                        if (tTeamName.equals(scoreList.get(k).getTeamName())){
                                            float t=0;
                                            if (scoreList.get(k).getGeography()>0) t=scoreList.get(k).getGeography();
                                            if (t>0){
                                                tStudentNumber++;
                                                tCourseTotal+=t;
                                            }
                                        }
                                    } // end of 遍历成绩NO.9
                                    // 当前学科平均分存入teamCourseAve
                                    float tCourseTotalVal=0;
                                    if (tStudentNumber>0){
                                        tCourseTotalVal=Float.parseFloat(String.format("%.2f",tCourseTotal/tStudentNumber));//保留两位小数
                                    }
                                    teamCourseAve.setGeographyAve(tCourseTotalVal);
                                    break;
                                }
                                case "sports":{
                                    Integer tStudentNumber=0;//参考学生人数
                                    float tCourseTotal=0; // 当前学科总分tCourseTotal
                                    for (int k=0;k<scoreList.size();k++){ // 遍历成绩NO.10
                                        if (tTeamName.equals(scoreList.get(k).getTeamName())){
                                            float t=0;
                                            if (scoreList.get(k).getSports()>0) t=scoreList.get(k).getSports();
                                            if (t>0){
                                                tStudentNumber++;
                                                tCourseTotal+=t;
                                            }
                                        }
                                    } // end of 遍历成绩NO.10
                                    // 当前学科平均分存入teamCourseAve
                                    float tCourseTotalVal=0;
                                    if (tStudentNumber>0){
                                        tCourseTotalVal=Float.parseFloat(String.format("%.2f",tCourseTotal/tStudentNumber));//保留两位小数
                                    }
                                    teamCourseAve.setSportsAve(tCourseTotalVal);
                                    break;
                                }
                            }
                        } // end of 遍历学科
                        // 求当前班级总分平均分和参考人数
                        Integer tStudentNumber=0;//参考学生人数
                        float tTeamTotal=0; // 班级总分tTeamTotal
                        for (int k=0;k<scoreList.size();k++){ // 遍历成绩NO.0
                            if (tTeamName.equals(scoreList.get(k).getTeamName())){
                                float tTotal=scoreList.get(k).getTotal();
                                if (tTotal>0){
                                    tStudentNumber++;
                                    tTeamTotal+=tTotal;
                                }
                            }
                        } // end of 遍历成绩NO.0
                        // 总分平均分存入teamCourseAve
                        float tTeamTotalVal=0;
                        if (tStudentNumber>0){
                            tTeamTotalVal=Float.parseFloat(String.format("%.2f",tTeamTotal/tStudentNumber));//保留两位小数
                        }
                        teamCourseAve.setTotalAve(tTeamTotalVal);
                        // 参考人数存入teamCourseAve
                        teamCourseAve.setStudentNumber(tStudentNumber);
                        // 当前对象teamCourseAve存入列表
                        teamCourseAveList.add(teamCourseAve);
                    }// end of 遍历班级
                    // 统计结果列表批量存入数据表t_team_course_ave
                    teamCourseAveService.batchInsert(teamCourseAveList);
                    break;
                } //end of “班级学科平均分表t_team_course_ave“ **测试通过（利用了scoreList的结果）**
                case "t_team_course_median":{ // 班级学科中位数表的统计
                    List<TeamCourseMedian> teamCourseMedianList=new ArrayList<>();
                    for (int i=0;i<teamList.size();i++){ // 遍历班级
                        TeamCourseMedian teamCourseMedian=new TeamCourseMedian();
                        String tTeamName=teamList.get(i);

                        teamCourseMedian.setSemesterName(semesterName);
                        teamCourseMedian.setGradeName(gradeName);
                        teamCourseMedian.setExamName(examName);
                        teamCourseMedian.setCategoryName(categoryName);
                        teamCourseMedian.setTeamName(tTeamName);
                        for (int j=0;j<examCourseArr.length;j++){ // 遍历学科
                            String tCourseName=examCourseArr[j];//注意：程序中学科名称一直用的是英文名称。
                            List<Score> tScoreList = scoreService.getTeamCourseScoreByParam(
                                    gradeDatatableName,semesterName,examName,categoryName,tTeamName,tCourseName);
                            // 计算该学科的中位数
                            float tMedian=0;
                            // 去掉null的有效成绩个数。
                            int n=0;
                            for (int tn=0;tn<tScoreList.size();tn++){
                                if (tScoreList.get(tn)!=null) n++;
                                else break;
                            }
                            // 有“有效成绩”则继续统计
                            if (n>0){
                                switch (tCourseName) {
                                    case "chinese": {
                                        if (n%2==1) tMedian = tScoreList.get((n-1) / 2).getChinese(); //下标从0开始。(n+1)/2-1=(n-1)/2
                                        else tMedian =(tScoreList.get((n-2)/2).getChinese()+tScoreList.get(n/2).getChinese())/2;
                                        teamCourseMedian.setChineseMedian(tMedian);
                                        break;}
                                    case "maths":{
                                        if (n%2==1) tMedian = tScoreList.get((n-1) / 2).getMaths();
                                        else tMedian =(tScoreList.get((n-2)/2).getMaths()+tScoreList.get(n/2).getMaths())/2;
                                        teamCourseMedian.setMathsMedian(tMedian);
                                        break;}
                                    case "english":{
                                        if (n%2==1) tMedian = tScoreList.get((n - 1) / 2).getEnglish();
                                        else tMedian =(tScoreList.get((n-2)/2).getEnglish()+tScoreList.get(n/2).getEnglish())/2;
                                        teamCourseMedian.setEnglishMedian(tMedian);
                                        break;}
                                    case "physics":{
                                        if (n%2==1) tMedian = tScoreList.get((n - 1) / 2).getPhysics();
                                        else tMedian =(tScoreList.get((n-2)/2).getPhysics()+tScoreList.get(n/2).getPhysics())/2;
                                        teamCourseMedian.setPhysicsMedian(tMedian);
                                        break;}
                                    case "history":{
                                        if (n%2==1) tMedian = tScoreList.get((n-1)/2).getHistory();
                                        else tMedian =(tScoreList.get((n-2)/2).getHistory()+tScoreList.get(n/2).getHistory())/2;
                                        teamCourseMedian.setHistoryMedian(tMedian);
                                        break;}
                                    case "chemistry":{
                                        if (n%2==1) tMedian = tScoreList.get((n-1)/2).getChemistry();
                                        else tMedian =(tScoreList.get((n-2)/2).getChemistry()+tScoreList.get(n/2).getChemistry())/2;
                                        teamCourseMedian.setChemistryMedian(tMedian);
                                        break;}
                                    case "biology":{
                                        if (n%2==1) tMedian = tScoreList.get((n-1)/2).getBiology();
                                        else tMedian =(tScoreList.get((n-2)/2).getBiology()+tScoreList.get(n/2).getBiology())/2;
                                        teamCourseMedian.setBiologyMedian(tMedian);
                                        break;}
                                    case "politics":{
                                        if (n%2==1) tMedian = tScoreList.get((n-1)/2).getPolitics();
                                        else tMedian =(tScoreList.get((n-2)/2).getPolitics()+tScoreList.get(n/2).getPolitics())/2;
                                        teamCourseMedian.setPoliticsMedian(tMedian);
                                        break;}
                                    case "geography":{
                                        if (n%2==1) tMedian = tScoreList.get((n-1)/2).getGeography();
                                        else tMedian =(tScoreList.get((n-2)/2).getGeography()+tScoreList.get(n/2).getGeography())/2;
                                        teamCourseMedian.setGeographyMedian(tMedian);
                                        break;}
                                    case "sports":{
                                        if (n%2==1) tMedian = tScoreList.get((n-1)/2).getSports();
                                        else tMedian =(tScoreList.get((n-2)/2).getSports()+tScoreList.get(n/2).getSports())/2;
                                        teamCourseMedian.setSportsMedian(tMedian);
                                        break;}
                                } // end of "tCourseName"
                            }
                        }// end of 遍历学科
                        // 求当前班级总分平均分和参考人数
                        Integer tStudentNumber=0;//参考学生人数
                        float tTeamTotal=0; // 班级总分tTeamTotal
                        for (int k=0;k<scoreList.size();k++){ // 遍历成绩NO.0
                            if (tTeamName.equals(scoreList.get(k).getTeamName())){
                                float tTotal=scoreList.get(k).getTotal();
                                if (tTotal>0){
                                    tStudentNumber++;
                                    tTeamTotal+=tTotal;
                                }
                            }
                        } // end of 遍历成绩NO.0
                        // 总分平均分存入teamCourseMedian
                        float tTeamTotalVal=0;
                        if (tStudentNumber>0){
                            tTeamTotalVal=Float.parseFloat(String.format("%.2f",tTeamTotal/tStudentNumber));//保留两位小数
                        }
                        teamCourseMedian.setTotalAve(tTeamTotalVal);
                        // 参考人数存入teamCourseMedian
                        teamCourseMedian.setStudentNumber(tStudentNumber);
                        teamCourseMedianList.add(teamCourseMedian);//当前班级的所有参考学科的信息加入列表
                    }//end of 遍历班级
                    // 所有班级的中位数信息存入数据表t_team_course_median
                    teamCourseMedianService.batchInsert(teamCourseMedianList);
                    break;
                }// end of “班级学科中位数team_course_median” **测试通过（多次从数据库提取记录 ）**
                case "t_team_course_rate":{
                    /** 统计班级学科四率：
                     * totalStudentNumber:学科总参考人数
                     * totalBadNum:学科差生人数 totalGoodNum:学科及格人数  totalBetterNum:学科良好人数  totalBestNum:学科优生人数
                     * totalBadRate：学科差生率 totalGoodRate：学科及格率 totalBetterRate：学科良好率 totalBestRate：学科优生率
                     * teamStudentNumber:班级总参考人数，
                     * teamBadNum:班级差生人数 teamGoodNum:班级及格人数  teamBetterNum:班级良好人数  teamBestNum:班级优生人数
                     * teamBadRate：班级差生率 teamGoodRate：班级及格率 teamBetterRate：班级良好率 teamBestRate：班级优生率
                    **/
                    // 定义存放四率统计结果记录的列表
                    List<TeamCourseRate> teamCourseRateList=new ArrayList<>();
                    // 按照班级统计
                    for (int i=0;i<teamList.size();i++) {
                        String tTeamName=teamList.get(i);//获取当前班级名称;
                        // 按照学科统计
                        for (int j=0;j<examCourseArr.length;j++){
                            TeamCourseRate teamCourseRate=new TeamCourseRate();
                            teamCourseRate.setSemesterName(semesterName);
                            teamCourseRate.setGradeName(gradeName);
                            teamCourseRate.setExamName(examName);
                            teamCourseRate.setCategoryName(categoryName);
                            teamCourseRate.setTeamName(tTeamName);

                            String tCourseEnName=examCourseArr[j]; // 获取当前学科英文名称
                            String chName="";// 存入中文名称
                            switch (tCourseEnName){
                                case "chinese":{chName="语文";break;}
                                case "maths":{chName="数学";break;}
                                case "english":{chName="英语";break;}
                                case "physics":{chName="物理";break;}
                                case "history":{chName="历史";break;}
                                case "chemistry":{chName="化学";break;}
                                case "biology":{chName="生物";break;}
                                case "politics":{chName="政治";break;}
                                case "geography":{chName="地理";break;}
                                case "sports":{chName="体育";break;}
                            }
                            teamCourseRate.setCourseEnName(tCourseEnName);
                            teamCourseRate.setCourseChName(chName);//存入学科中文名称
                            int totalStudentNumber=0,totalBadNum=0,totalGoodNum=0,totalBetterNum=0,totalBestNum=0;
                            int teamStudentNumber=0,teamBadNum=0,teamGoodNum=0,teamBetterNum=0,teamBestNum=0;
                            float totalBadRate=0,totalGoodRate=0,totalBetterRate=0,totalBestRate=0;
                            float teamBadRate=0,teamGoodRate=0,teamBetterRate=0,teamBestRate=0;
                            switch (tCourseEnName){
                                case "chinese":{
                                     float bad=statisticsParamiter.getChineseBad();
                                     float good=statisticsParamiter.getChineseGood();
                                     float better=statisticsParamiter.getChineseBetter();
                                     float best=statisticsParamiter.getChineseBest();
                                    // 遍历成绩列表scoreList
                                    for (int k=0;k<scoreList.size();k++){
                                        //统计本学科总的参考人数和四率
                                        float t=0;
                                        if (scoreList.get(k).getChinese()>0) t=scoreList.get(k).getChinese();
                                        if (t>0) {
                                            totalStudentNumber++;
                                            if (t<bad) totalBadNum++;
                                            if (t>=good) totalGoodNum++;
                                            if (t>=better) totalBetterNum++;
                                            if (t>=best) totalBestNum++;
                                            // 统计当前班级本学科的参考人数和四率
                                            String tTeam=scoreList.get(k).getTeamName();
                                            if (tTeamName.equals(tTeam)){
                                                teamStudentNumber++;
                                                if (t<bad) teamBadNum++;
                                                if (t>=good) teamGoodNum++;
                                                if (t>=better) teamBetterNum++;
                                                if (t>=best) teamBestNum++;
                                            }
                                        }
                                    }// end of 成绩列表
                                    if (totalStudentNumber>0){
                                        totalBadRate=Float.parseFloat(String.format("%.2f",totalBadNum*1.0/totalStudentNumber));//保留两位小数
                                        totalGoodRate=Float.parseFloat(String.format("%.2f",totalGoodNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBetterRate=Float.parseFloat(String.format("%.2f",totalBetterNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBestRate=Float.parseFloat(String.format("%.2f",totalBestNum*1.0/totalStudentNumber));//保留两位小数
                                        if (teamStudentNumber>0){
                                             teamBadRate=Float.parseFloat(String.format("%.2f",teamBadNum*1.0/teamStudentNumber));//保留两位小数
                                             teamGoodRate=Float.parseFloat(String.format("%.2f",teamGoodNum*1.0/teamStudentNumber));//保留两位小数
                                             teamBetterRate=Float.parseFloat(String.format("%.2f",teamBetterNum*1.0/teamStudentNumber));//保留两位小数
                                             teamBestRate=Float.parseFloat(String.format("%.2f",teamBestNum*1.0/teamStudentNumber));//保留两位小数
                                        }
                                    }
                                    break;
                                } // end of "chinese"
                                case "maths":{
                                    float bad=statisticsParamiter.getMathsBad();
                                    float good=statisticsParamiter.getMathsGood();
                                    float better=statisticsParamiter.getMathsBetter();
                                    float best=statisticsParamiter.getMathsBest();
                                    // 遍历成绩列表scoreList
                                    for (int k=0;k<scoreList.size();k++){
                                        //统计本学科总的参考人数和四率
                                        float t=0;
                                        if (scoreList.get(k).getMaths()>0) t=scoreList.get(k).getMaths();
                                        if (t>0) {
                                            totalStudentNumber++;
                                            if (t<bad) totalBadNum++;
                                            if (t>=good) totalGoodNum++;
                                            if (t>=better) totalBetterNum++;
                                            if (t>=best) totalBestNum++;
                                            // 统计当前班级本学科的参考人数和四率
                                            String tTeam=scoreList.get(k).getTeamName();
                                            if (tTeamName.equals(tTeam)){
                                                teamStudentNumber++;
                                                if (t<bad) teamBadNum++;
                                                if (t>=good) teamGoodNum++;
                                                if (t>=better) teamBetterNum++;
                                                if (t>=best) teamBestNum++;
                                            }
                                        }
                                    }// end of 成绩列表
                                    if (totalStudentNumber>0){
                                        totalBadRate=Float.parseFloat(String.format("%.2f",totalBadNum*1.0/totalStudentNumber));//保留两位小数
                                        totalGoodRate=Float.parseFloat(String.format("%.2f",totalGoodNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBetterRate=Float.parseFloat(String.format("%.2f",totalBetterNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBestRate=Float.parseFloat(String.format("%.2f",totalBestNum*1.0/totalStudentNumber));//保留两位小数
                                        if (teamStudentNumber>0){
                                            teamBadRate=Float.parseFloat(String.format("%.2f",teamBadNum*1.0/teamStudentNumber));//保留两位小数
                                            teamGoodRate=Float.parseFloat(String.format("%.2f",teamGoodNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBetterRate=Float.parseFloat(String.format("%.2f",teamBetterNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBestRate=Float.parseFloat(String.format("%.2f",teamBestNum*1.0/teamStudentNumber));//保留两位小数
                                        }
                                    }
                                    break;
                                } // end of ""maths
                                case "english":{
                                    float bad=statisticsParamiter.getEnglishBad();
                                    float good=statisticsParamiter.getEnglishGood();
                                    float better=statisticsParamiter.getEnglishBetter();
                                    float best=statisticsParamiter.getEnglishBest();
                                    // 遍历成绩列表scoreList
                                    for (int k=0;k<scoreList.size();k++){
                                        //统计本学科总的参考人数和四率
                                        float t=0;
                                        if (scoreList.get(k).getEnglish()>0) t=scoreList.get(k).getEnglish();
                                        if (t>0) {
                                            totalStudentNumber++;
                                            if (t<bad) totalBadNum++;
                                            if (t>=good) totalGoodNum++;
                                            if (t>=better) totalBetterNum++;
                                            if (t>=best) totalBestNum++;
                                            // 统计当前班级本学科的参考人数和四率
                                            String tTeam=scoreList.get(k).getTeamName();
                                            if (tTeamName.equals(tTeam)){
                                                teamStudentNumber++;
                                                if (t<bad) teamBadNum++;
                                                if (t>=good) teamGoodNum++;
                                                if (t>=better) teamBetterNum++;
                                                if (t>=best) teamBestNum++;
                                            }
                                        }
                                    }// end of 成绩列表
                                    if (totalStudentNumber>0){
                                        totalBadRate=Float.parseFloat(String.format("%.2f",totalBadNum*1.0/totalStudentNumber));//保留两位小数
                                        totalGoodRate=Float.parseFloat(String.format("%.2f",totalGoodNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBetterRate=Float.parseFloat(String.format("%.2f",totalBetterNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBestRate=Float.parseFloat(String.format("%.2f",totalBestNum*1.0/totalStudentNumber));//保留两位小数
                                        if (teamStudentNumber>0){
                                            teamBadRate=Float.parseFloat(String.format("%.2f",teamBadNum*1.0/teamStudentNumber));//保留两位小数
                                            teamGoodRate=Float.parseFloat(String.format("%.2f",teamGoodNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBetterRate=Float.parseFloat(String.format("%.2f",teamBetterNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBestRate=Float.parseFloat(String.format("%.2f",teamBestNum*1.0/teamStudentNumber));//保留两位小数
                                        }
                                    }
                                    break;
                                }//end of "english"
                                case "physics":{
                                    float bad=statisticsParamiter.getPhysicsBad();
                                    float good=statisticsParamiter.getPhysicsGood();
                                    float better=statisticsParamiter.getPhysicsBetter();
                                    float best=statisticsParamiter.getPhysicsBest();
                                    // 遍历成绩列表scoreList
                                    for (int k=0;k<scoreList.size();k++){
                                        //统计本学科总的参考人数和四率
                                        float t=0;
                                        if (scoreList.get(k).getPhysics()>0) t=scoreList.get(k).getPhysics();
                                        if (t>0) {
                                            totalStudentNumber++;
                                            if (t<bad) totalBadNum++;
                                            if (t>=good) totalGoodNum++;
                                            if (t>=better) totalBetterNum++;
                                            if (t>=best) totalBestNum++;
                                            // 统计当前班级本学科的参考人数和四率
                                            String tTeam=scoreList.get(k).getTeamName();
                                            if (tTeamName.equals(tTeam)){
                                                teamStudentNumber++;
                                                if (t<bad) teamBadNum++;
                                                if (t>=good) teamGoodNum++;
                                                if (t>=better) teamBetterNum++;
                                                if (t>=best) teamBestNum++;
                                            }
                                        }
                                    }// end of 成绩列表
                                    if (totalStudentNumber>0){
                                        totalBadRate=Float.parseFloat(String.format("%.2f",totalBadNum*1.0/totalStudentNumber));//保留两位小数
                                        totalGoodRate=Float.parseFloat(String.format("%.2f",totalGoodNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBetterRate=Float.parseFloat(String.format("%.2f",totalBetterNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBestRate=Float.parseFloat(String.format("%.2f",totalBestNum*1.0/totalStudentNumber));//保留两位小数
                                        if (teamStudentNumber>0){
                                            teamBadRate=Float.parseFloat(String.format("%.2f",teamBadNum*1.0/teamStudentNumber));//保留两位小数
                                            teamGoodRate=Float.parseFloat(String.format("%.2f",teamGoodNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBetterRate=Float.parseFloat(String.format("%.2f",teamBetterNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBestRate=Float.parseFloat(String.format("%.2f",teamBestNum*1.0/teamStudentNumber));//保留两位小数
                                        }
                                    }
                                    break;
                                }//end of "physics"
                                case "history":{
                                    float bad=statisticsParamiter.getHistoryBad();
                                    float good=statisticsParamiter.getHistoryGood();
                                    float better=statisticsParamiter.getHistoryBetter();
                                    float best=statisticsParamiter.getHistoryBest();
                                    // 遍历成绩列表scoreList
                                    for (int k=0;k<scoreList.size();k++){
                                        //统计本学科总的参考人数和四率
                                        float t=0;
                                        if (scoreList.get(k).getHistory()>0) t=scoreList.get(k).getHistory();
                                        if (t>0) {
                                            totalStudentNumber++;
                                            if (t<bad) totalBadNum++;
                                            if (t>=good) totalGoodNum++;
                                            if (t>=better) totalBetterNum++;
                                            if (t>=best) totalBestNum++;
                                            // 统计当前班级本学科的参考人数和四率
                                            String tTeam=scoreList.get(k).getTeamName();
                                            if (tTeamName.equals(tTeam)){
                                                teamStudentNumber++;
                                                if (t<bad) teamBadNum++;
                                                if (t>=good) teamGoodNum++;
                                                if (t>=better) teamBetterNum++;
                                                if (t>=best) teamBestNum++;
                                            }
                                        }
                                    }// end of 成绩列表
                                    if (totalStudentNumber>0){
                                        totalBadRate=Float.parseFloat(String.format("%.2f",totalBadNum*1.0/totalStudentNumber));//保留两位小数
                                        totalGoodRate=Float.parseFloat(String.format("%.2f",totalGoodNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBetterRate=Float.parseFloat(String.format("%.2f",totalBetterNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBestRate=Float.parseFloat(String.format("%.2f",totalBestNum*1.0/totalStudentNumber));//保留两位小数
                                        if (teamStudentNumber>0){
                                            teamBadRate=Float.parseFloat(String.format("%.2f",teamBadNum*1.0/teamStudentNumber));//保留两位小数
                                            teamGoodRate=Float.parseFloat(String.format("%.2f",teamGoodNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBetterRate=Float.parseFloat(String.format("%.2f",teamBetterNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBestRate=Float.parseFloat(String.format("%.2f",teamBestNum*1.0/teamStudentNumber));//保留两位小数
                                        }
                                    }
                                    break;
                                }//end of "history"
                                case "chemistry":{
                                    float bad=statisticsParamiter.getChemistryBad();
                                    float good=statisticsParamiter.getChemistryGood();
                                    float better=statisticsParamiter.getChemistryBetter();
                                    float best=statisticsParamiter.getChemistryBest();
                                    // 遍历成绩列表scoreList
                                    for (int k=0;k<scoreList.size();k++){
                                        //统计本学科总的参考人数和四率
                                        float t=0;
                                        if (scoreList.get(k).getChemistry()>0) t=scoreList.get(k).getChemistry();
                                        if (t>0) {
                                            totalStudentNumber++;
                                            if (t<bad) totalBadNum++;
                                            if (t>=good) totalGoodNum++;
                                            if (t>=better) totalBetterNum++;
                                            if (t>=best) totalBestNum++;
                                            // 统计当前班级本学科的参考人数和四率
                                            String tTeam=scoreList.get(k).getTeamName();
                                            if (tTeamName.equals(tTeam)){
                                                teamStudentNumber++;
                                                if (t<bad) teamBadNum++;
                                                if (t>=good) teamGoodNum++;
                                                if (t>=better) teamBetterNum++;
                                                if (t>=best) teamBestNum++;
                                            }
                                        }
                                    }// end of 成绩列表
                                    if (totalStudentNumber>0){
                                        totalBadRate=Float.parseFloat(String.format("%.2f",totalBadNum*1.0/totalStudentNumber));//保留两位小数
                                        totalGoodRate=Float.parseFloat(String.format("%.2f",totalGoodNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBetterRate=Float.parseFloat(String.format("%.2f",totalBetterNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBestRate=Float.parseFloat(String.format("%.2f",totalBestNum*1.0/totalStudentNumber));//保留两位小数
                                        if (teamStudentNumber>0){
                                            teamBadRate=Float.parseFloat(String.format("%.2f",teamBadNum*1.0/teamStudentNumber));//保留两位小数
                                            teamGoodRate=Float.parseFloat(String.format("%.2f",teamGoodNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBetterRate=Float.parseFloat(String.format("%.2f",teamBetterNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBestRate=Float.parseFloat(String.format("%.2f",teamBestNum*1.0/teamStudentNumber));//保留两位小数
                                        }
                                    }
                                    break;
                                }// end of "chemistry"
                                case "biology":{
                                    float bad=statisticsParamiter.getBiologyBad();
                                    float good=statisticsParamiter.getBiologyGood();
                                    float better=statisticsParamiter.getBiologyBetter();
                                    float best=statisticsParamiter.getBiologyBest();
                                    // 遍历成绩列表scoreList
                                    for (int k=0;k<scoreList.size();k++){
                                        //统计本学科总的参考人数和四率
                                        float t=0;
                                        if (scoreList.get(k).getBiology()>0) t=scoreList.get(k).getBiology();
                                        if (t>0) {
                                            totalStudentNumber++;
                                            if (t<bad) totalBadNum++;
                                            if (t>=good) totalGoodNum++;
                                            if (t>=better) totalBetterNum++;
                                            if (t>=best) totalBestNum++;
                                            // 统计当前班级本学科的参考人数和四率
                                            String tTeam=scoreList.get(k).getTeamName();
                                            if (tTeamName.equals(tTeam)){
                                                teamStudentNumber++;
                                                if (t<bad) teamBadNum++;
                                                if (t>=good) teamGoodNum++;
                                                if (t>=better) teamBetterNum++;
                                                if (t>=best) teamBestNum++;
                                            }
                                        }
                                    }// end of 成绩列表
                                    if (totalStudentNumber>0){
                                        totalBadRate=Float.parseFloat(String.format("%.2f",totalBadNum*1.0/totalStudentNumber));//保留两位小数
                                        totalGoodRate=Float.parseFloat(String.format("%.2f",totalGoodNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBetterRate=Float.parseFloat(String.format("%.2f",totalBetterNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBestRate=Float.parseFloat(String.format("%.2f",totalBestNum*1.0/totalStudentNumber));//保留两位小数
                                        if (teamStudentNumber>0){
                                            teamBadRate=Float.parseFloat(String.format("%.2f",teamBadNum*1.0/teamStudentNumber));//保留两位小数
                                            teamGoodRate=Float.parseFloat(String.format("%.2f",teamGoodNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBetterRate=Float.parseFloat(String.format("%.2f",teamBetterNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBestRate=Float.parseFloat(String.format("%.2f",teamBestNum*1.0/teamStudentNumber));//保留两位小数
                                        }
                                    }
                                    break;
                                }//end of "biology"
                                case "politics":{
                                    float bad=statisticsParamiter.getPoliticsBad();
                                    float good=statisticsParamiter.getPoliticsGood();
                                    float better=statisticsParamiter.getPoliticsBetter();
                                    float best=statisticsParamiter.getPoliticsBest();
                                    // 遍历成绩列表scoreList
                                    for (int k=0;k<scoreList.size();k++){
                                        //统计本学科总的参考人数和四率
                                        float t=0;
                                        if (scoreList.get(k).getPolitics()>0) t=scoreList.get(k).getPolitics();
                                        if (t>0) {
                                            totalStudentNumber++;
                                            if (t<bad) totalBadNum++;
                                            if (t>=good) totalGoodNum++;
                                            if (t>=better) totalBetterNum++;
                                            if (t>=best) totalBestNum++;
                                            // 统计当前班级本学科的参考人数和四率
                                            String tTeam=scoreList.get(k).getTeamName();
                                            if (tTeamName.equals(tTeam)){
                                                teamStudentNumber++;
                                                if (t<bad) teamBadNum++;
                                                if (t>=good) teamGoodNum++;
                                                if (t>=better) teamBetterNum++;
                                                if (t>=best) teamBestNum++;
                                            }
                                        }
                                    }// end of 成绩列表
                                    if (totalStudentNumber>0){
                                        totalBadRate=Float.parseFloat(String.format("%.2f",totalBadNum*1.0/totalStudentNumber));//保留两位小数
                                        totalGoodRate=Float.parseFloat(String.format("%.2f",totalGoodNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBetterRate=Float.parseFloat(String.format("%.2f",totalBetterNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBestRate=Float.parseFloat(String.format("%.2f",totalBestNum*1.0/totalStudentNumber));//保留两位小数
                                        if (teamStudentNumber>0){
                                            teamBadRate=Float.parseFloat(String.format("%.2f",teamBadNum*1.0/teamStudentNumber));//保留两位小数
                                            teamGoodRate=Float.parseFloat(String.format("%.2f",teamGoodNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBetterRate=Float.parseFloat(String.format("%.2f",teamBetterNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBestRate=Float.parseFloat(String.format("%.2f",teamBestNum*1.0/teamStudentNumber));//保留两位小数
                                        }
                                    }
                                    break;
                                }//end of "politics"
                                case "geography":{
                                    float bad=statisticsParamiter.getGeographyBad();
                                    float good=statisticsParamiter.getGeographyGood();
                                    float better=statisticsParamiter.getGeographyBetter();
                                    float best=statisticsParamiter.getGeographyBest();
                                    // 遍历成绩列表scoreList
                                    for (int k=0;k<scoreList.size();k++){
                                        //统计本学科总的参考人数和四率
                                        float t=0;
                                        if (scoreList.get(k).getGeography()>0) t=scoreList.get(k).getGeography();
                                        if (t>0) {
                                            totalStudentNumber++;
                                            if (t<bad) totalBadNum++;
                                            if (t>=good) totalGoodNum++;
                                            if (t>=better) totalBetterNum++;
                                            if (t>=best) totalBestNum++;
                                            // 统计当前班级本学科的参考人数和四率
                                            String tTeam=scoreList.get(k).getTeamName();
                                            if (tTeamName.equals(tTeam)){
                                                teamStudentNumber++;
                                                if (t<bad) teamBadNum++;
                                                if (t>=good) teamGoodNum++;
                                                if (t>=better) teamBetterNum++;
                                                if (t>=best) teamBestNum++;
                                            }
                                        }
                                    }// end of 成绩列表
                                    if (totalStudentNumber>0){
                                        totalBadRate=Float.parseFloat(String.format("%.2f",totalBadNum*1.0/totalStudentNumber));//保留两位小数
                                        totalGoodRate=Float.parseFloat(String.format("%.2f",totalGoodNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBetterRate=Float.parseFloat(String.format("%.2f",totalBetterNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBestRate=Float.parseFloat(String.format("%.2f",totalBestNum*1.0/totalStudentNumber));//保留两位小数
                                        if (teamStudentNumber>0){
                                            teamBadRate=Float.parseFloat(String.format("%.2f",teamBadNum*1.0/teamStudentNumber));//保留两位小数
                                            teamGoodRate=Float.parseFloat(String.format("%.2f",teamGoodNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBetterRate=Float.parseFloat(String.format("%.2f",teamBetterNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBestRate=Float.parseFloat(String.format("%.2f",teamBestNum*1.0/teamStudentNumber));//保留两位小数
                                        }
                                    }
                                    break;
                                }//end of "geography"
                                case "sports":{
                                    float bad=statisticsParamiter.getSportsBad();
                                    float good= statisticsParamiter.getSportsGood();
                                    float better=statisticsParamiter.getSportsBetter();
                                    float best=statisticsParamiter.getSportsBest();
                                    // 遍历成绩列表scoreList
                                    for (int k=0;k<scoreList.size();k++){
                                        //统计本学科总的参考人数和四率
                                        float t=0;
                                        if (scoreList.get(k).getSports()>0) t=scoreList.get(k).getSports();
                                        if (t>0) {
                                            totalStudentNumber++;
                                            if (t<bad) totalBadNum++;
                                            if (t>=good) totalGoodNum++;
                                            if (t>=better) totalBetterNum++;
                                            if (t>=best) totalBestNum++;
                                            // 统计当前班级本学科的参考人数和四率
                                            String tTeam=scoreList.get(k).getTeamName();
                                            if (tTeamName.equals(tTeam)){
                                                teamStudentNumber++;
                                                if (t<bad) teamBadNum++;
                                                if (t>=good) teamGoodNum++;
                                                if (t>=better) teamBetterNum++;
                                                if (t>=best) teamBestNum++;
                                            }
                                        }
                                    }// end of 成绩列表
                                    if (totalStudentNumber>0){
                                        totalBadRate=Float.parseFloat(String.format("%.2f",totalBadNum*1.0/totalStudentNumber));//保留两位小数
                                        totalGoodRate=Float.parseFloat(String.format("%.2f",totalGoodNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBetterRate=Float.parseFloat(String.format("%.2f",totalBetterNum*1.0/totalStudentNumber));//保留两位小数
                                        totalBestRate=Float.parseFloat(String.format("%.2f",totalBestNum*1.0/totalStudentNumber));//保留两位小数
                                        if (teamStudentNumber>0){
                                            teamBadRate=Float.parseFloat(String.format("%.2f",teamBadNum*1.0/teamStudentNumber));//保留两位小数
                                            teamGoodRate=Float.parseFloat(String.format("%.2f",teamGoodNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBetterRate=Float.parseFloat(String.format("%.2f",teamBetterNum*1.0/teamStudentNumber));//保留两位小数
                                            teamBestRate=Float.parseFloat(String.format("%.2f",teamBestNum*1.0/teamStudentNumber));//保留两位小数
                                        }
                                    }
                                    break;
                                }//end of "sports"
                            }// end of switch (tCourseName)
                            //四率存入班级学科四率teamCourseRate对象
                            teamCourseRate.setTotalStudentNumber(totalStudentNumber);
                            teamCourseRate.setTotalBadRate(totalBadRate);
                            teamCourseRate.setTotalGoodRate(totalGoodRate);
                            teamCourseRate.setTotalBetterRate(totalBetterRate);
                            teamCourseRate.setTotalBestRate(totalBestRate);

                            teamCourseRate.setTeamStudentNumber(teamStudentNumber);
                            teamCourseRate.setTeamBadRate(teamBadRate);
                            teamCourseRate.setTeamGoodRate(teamGoodRate);
                            teamCourseRate.setTeamBetterRate(teamBetterRate);
                            teamCourseRate.setTeamBestRate(teamBestRate);

                            // 班级学科四率teamCourseRate对象存入列表
                            teamCourseRateList.add(teamCourseRate);
                        } // end of 学科
                    } // end of 班级
                    // 统计结果存入数据库的班级学科四率表（t_team_course_rate）
                    teamCourseRateService.batchInsert(teamCourseRateList);
                    break;
                    } // end of "班级学科四率表t_team_course_rate" **测试通过（利用了scoreList的结果）**
                case "t_total_divide":{ //班级总分一分段表
                    // 定义存放统计结果“总分班级一分段表”的记录的列表
                    List<TotalDivide> totalDivideList=new ArrayList<>();
                    // Integer examScore=exam.getExamScore(); //本次考试的总分
                    float maxScore=scoreList.get(0).getTotal();//本次考试的总分最高分
                    float minScore=0;//本次考试的总分最低分(总分为0的忽略)
                    for (int i=scoreList.size()-1;i>=0;i--){
                        float t=scoreList.get(i).getTotal();
                        if (t>0) {minScore=t;break;}
                    }
                    
                    for (int si=Math.round(maxScore);si>=minScore;si--) { //si:第i种分数,只存储总分学生人数非零的记录
                        Integer totalStudentNumber=0;//年级总分一分段总学生人数初始化为0
                        Map<String,Integer> teamStudentMap=new HashMap<>();//(<班级名称>,<总分一分段学生人数>)初始化为0
                        for (int ti=0;ti<teamList.size();ti++){//
                            teamStudentMap.put(teamList.get(ti),0);
                        }

                       for (int j=0;j<scoreList.size();j++){//遍历成绩列表，（成绩总分已经降序排序）
                           float tsj=scoreList.get(j).getTotal();//第j个学生的总成绩
                           if (tsj>=si){
                               totalStudentNumber++; //当前分值的总人数加1
                               Integer tTeamStudentNumber=teamStudentMap.get(scoreList.get(j).getTeamName());// 从Map取值
                               tTeamStudentNumber++;// 当前分值，当前班级的学生总人数加1
                               teamStudentMap.put(scoreList.get(j).getTeamName(),tTeamStudentNumber);//值存入Map
                           }
                           if (tsj<si) break;// 因为成绩降序排列，后面的成绩记录不用找了。
                       }// end of 遍历成绩列表
                        if (totalStudentNumber>0){ //当前成绩si对应的总人数有,才分班级存储
                            for (Map.Entry<String,Integer> entry:teamStudentMap.entrySet()){
                                TotalDivide totalDivide=new TotalDivide(); // 存储当前班级一分段的信息
                                totalDivide.setSemesterName(semesterName);
                                totalDivide.setGradeName(gradeName);
                                totalDivide.setExamName(examName);
                                totalDivide.setCategoryName(categoryName);
                                totalDivide.setTeamName(entry.getKey());//当前班级名称
                                totalDivide.setTotalDivide(si);// 当前总分一分段分值
                                totalDivide.setTotalStudentNumber(totalStudentNumber);// 总人数
                                totalDivide.setTeamStudentNumber(entry.getValue());// 当前班级的人数
                                // 当前分数si对应的统计记录存入列表totalDivideList
                                totalDivideList.add(totalDivide);
                       } // end of 遍历"班级学生映射 teamStudentMap“
                      } // end of if (totalStudentNumber>0"
                    } //end of 遍历分数段
                    // totalDivideList存入“总分一分段表t_total_divide”
                    totalDivideService.batchInsert(totalDivideList);
                    break;
                } // end of "总分一分段表 t_total_divide" **测试通过** (利用了scoreList的结果)
                case "t_course_divide":{// 班级学科一分段表，不统计学科成绩为“0”分。
                    // 定义存放统计结果“班级学科一分段表”的记录的列表
                    List<CourseDivide> courseDivideList=new ArrayList<>();
                    // 按学科遍历
                    for (int ci=0;ci<examCourseArr.length;ci++){
                        String tCourseEnName=examCourseArr[ci]; //学科英文名称
                        // 中文名称
                        String chName="";
                        switch (examCourseArr[ci]){
                            case "chinese":{chName="语文";break;}
                            case "maths":{chName="数学";break;}
                            case "english":{chName="英语";break;}
                            case "physics":{chName="物理";break;}
                            case "history":{chName="历史";break;}
                            case "chemistry":{chName="化学";break;}
                            case "biology":{chName="生物";break;}
                            case "politics":{chName="政治";break;}
                            case "geography":{chName="地理";break;}
                            case "sports":{chName="体育";break;}
                        }
                        switch (tCourseEnName){
                            case "chinese":{
                                // 整理scoreList数据，按照当前学科降序排序
                                Collections.sort(scoreList, new Comparator<Score>() {
                                    @Override
                                    public int compare(Score o1, Score o2) {
                                        return Math.round(o2.getChinese())-Math.round(o1.getChinese()); //降序排列
                                    }
                                });
                                float maxScore=scoreList.get(0).getChinese();//本次考试的语文最高分
                                // 查找当前成绩的最小值，忽略掉"0"分
                                float minScore=0;//本次考试的语文最低分
                                for(int ti=scoreList.size()-1;ti>=0;ti--){
                                    float t=scoreList.get(ti).getChinese();
                                    if (t>0) {minScore=t;break;}
                                }
                                for (int si=Math.round(maxScore);si>=minScore;si--) { //si:第i种分数,只存储总分学生人数非零的记录
                                    Integer totalStudentNumber=0;//年级总分一分段总学生人数初始化为0
                                    Map<String,Integer> teamStudentMap=new HashMap<>();//(<班级名称>,<学科总分一分段学生人数>)初始化为0
                                    for (int ti=0;ti<teamList.size();ti++){//
                                        teamStudentMap.put(teamList.get(ti),0);
                                    }

                                    for (int j=0;j<scoreList.size();j++){//遍历成绩列表，（语文成绩已经降序排序）
                                        float tsj=scoreList.get(j).getChinese();//第j个学生的语文成绩
                                        if (tsj>=si){
                                            totalStudentNumber++; //当前分值的总人数加1
                                            Integer tTeamStudentNumber=teamStudentMap.get(scoreList.get(j).getTeamName());// 从Map取值
                                            tTeamStudentNumber++;// 当前分值，当前班级的学生总人数加1
                                            teamStudentMap.put(scoreList.get(j).getTeamName(),tTeamStudentNumber);//值存入Map
                                        }
                                        if (tsj<si) break;// 因为语文成绩降序排列，后面的成绩记录不用找了。
                                    }// end of 遍历成绩列表
                                    if (totalStudentNumber>0){ //当前成绩si对应的总人数有,才分班级存储
                                        for (Map.Entry<String,Integer> entry:teamStudentMap.entrySet()){
                                            CourseDivide courseDivide=new CourseDivide(); // 存储当前班级学科一分段的信息
                                            courseDivide.setSemesterName(semesterName);
                                            courseDivide.setGradeName(gradeName);
                                            courseDivide.setExamName(examName);
                                            courseDivide.setCategoryName(categoryName);
                                            courseDivide.setTeamName(entry.getKey());//当前班级名称
                                            courseDivide.setCourseEnName(tCourseEnName);//当前学科英文名称
                                            courseDivide.setCourseChName(chName);//当前学科中文名称
                                            courseDivide.setCourseDivide(si);// 当前学科总分一分段分值
                                            courseDivide.setTotalCourseStudentNumber(totalStudentNumber);// 总人数
                                            courseDivide.setTeamCourseStudentNumber(entry.getValue());// 当前班级当前学科的人数
                                            // 当前分数si对应的统计记录存入列表totalDivideList
                                            courseDivideList.add(courseDivide);
                                        } // end of 遍历"班级学生映射 teamStudentMap“
                                    } // end of if (totalStudentNumber>0"
                                } //end of 遍历分数段
                                break;}
                            case "maths":{
                                Collections.sort(scoreList, new Comparator<Score>() {
                                    @Override
                                    public int compare(Score o1, Score o2) {
                                        return Math.round(o2.getMaths())-Math.round(o1.getMaths()); //降序排列
                                    }
                                });
                                float maxScore=scoreList.get(0).getMaths();//本次考试的数学最高分
                                // 查找当前成绩的最小值，忽略掉"0"分
                                float minScore=0;//本次考试的数学最低分
                                for(int ti=scoreList.size()-1;ti>=0;ti--){
                                    float t=scoreList.get(ti).getMaths();
                                    if (t>0) {minScore=t;break;}
                                }
                                for (int si=Math.round(maxScore);si>=minScore;si--) { //si:第i种分数,只存储总分学生人数非零的记录
                                    Integer totalStudentNumber=0;//年级总分一分段总学生人数初始化为0
                                    Map<String,Integer> teamStudentMap=new HashMap<>();//(<班级名称>,<学科总分一分段学生人数>)初始化为0
                                    for (int ti=0;ti<teamList.size();ti++){//
                                        teamStudentMap.put(teamList.get(ti),0);
                                    }

                                    for (int j=0;j<scoreList.size();j++){//遍历成绩列表，（数学成绩已经降序排序）
                                        float tsj=scoreList.get(j).getMaths();//第j个学生的数学成绩
                                        if (tsj>=si){
                                            totalStudentNumber++; //当前分值的总人数加1
                                            Integer tTeamStudentNumber=teamStudentMap.get(scoreList.get(j).getTeamName());// 从Map取值
                                            tTeamStudentNumber++;// 当前分值，当前班级的学生总人数加1
                                            teamStudentMap.put(scoreList.get(j).getTeamName(),tTeamStudentNumber);//值存入Map
                                        }
                                        if (tsj<si) break;// 因为数学成绩降序排列，后面的成绩记录不用找了。
                                    }// end of 遍历成绩列表
                                    if (totalStudentNumber>0){ //当前成绩si对应的总人数有,才分班级存储
                                        for (Map.Entry<String,Integer> entry:teamStudentMap.entrySet()){
                                            CourseDivide courseDivide=new CourseDivide(); // 存储当前班级学科一分段的信息
                                            courseDivide.setSemesterName(semesterName);
                                            courseDivide.setGradeName(gradeName);
                                            courseDivide.setExamName(examName);
                                            courseDivide.setCategoryName(categoryName);
                                            courseDivide.setTeamName(entry.getKey());//当前班级名称
                                            courseDivide.setCourseEnName(tCourseEnName);//当前学科英文名称
                                            courseDivide.setCourseChName(chName);//当前学科中文名称
                                            courseDivide.setCourseDivide(si);// 当前学科总分一分段分值
                                            courseDivide.setTotalCourseStudentNumber(totalStudentNumber);// 总人数
                                            courseDivide.setTeamCourseStudentNumber(entry.getValue());// 当前班级当前学科的人数
                                            // 当前分数si对应的统计记录存入列表totalDivideList
                                            courseDivideList.add(courseDivide);
                                        } // end of 遍历"班级学生映射 teamStudentMap“
                                    } // end of if (totalStudentNumber>0"
                                } //end of 遍历分数段
                                break;
                            }
                            case "english":{
                                Collections.sort(scoreList, new Comparator<Score>() {
                                    @Override
                                    public int compare(Score o1, Score o2) {
                                        return Math.round(o2.getEnglish())-Math.round(o1.getEnglish()); //降序排列
                                    }
                                });
                                float maxScore=scoreList.get(0).getEnglish();//本次考试的英语最高分
                                // 查找当前成绩的最小值，忽略掉"0"分
                                float minScore=0;//本次考试的英语最低分
                                for(int ti=scoreList.size()-1;ti>=0;ti--){
                                    float t=scoreList.get(ti).getEnglish();
                                    if (t>0) {minScore=t;break;}
                                }
                                for (int si=Math.round(maxScore);si>=minScore;si--) { //si:第i种分数,只存储总分学生人数非零的记录
                                    Integer totalStudentNumber=0;//年级总分一分段总学生人数初始化为0
                                    Map<String,Integer> teamStudentMap=new HashMap<>();//(<班级名称>,<学科总分一分段学生人数>)初始化为0
                                    for (int ti=0;ti<teamList.size();ti++){//
                                        teamStudentMap.put(teamList.get(ti),0);
                                    }

                                    for (int j=0;j<scoreList.size();j++){//遍历成绩列表，（英语成绩已经降序排序）
                                        float tsj=scoreList.get(j).getEnglish();//第j个学生的数学成绩
                                        if (tsj>=si){
                                            totalStudentNumber++; //当前分值的总人数加1
                                            Integer tTeamStudentNumber=teamStudentMap.get(scoreList.get(j).getTeamName());// 从Map取值
                                            tTeamStudentNumber++;// 当前分值，当前班级的学生总人数加1
                                            teamStudentMap.put(scoreList.get(j).getTeamName(),tTeamStudentNumber);//值存入Map
                                        }
                                        if (tsj<si) break;// 因为英语成绩降序排列，后面的成绩记录不用找了。
                                    }// end of 遍历成绩列表
                                    if (totalStudentNumber>0){ //当前成绩si对应的总人数有,才分班级存储
                                        for (Map.Entry<String,Integer> entry:teamStudentMap.entrySet()){
                                            CourseDivide courseDivide=new CourseDivide(); // 存储当前班级学科一分段的信息
                                            courseDivide.setSemesterName(semesterName);
                                            courseDivide.setGradeName(gradeName);
                                            courseDivide.setExamName(examName);
                                            courseDivide.setCategoryName(categoryName);
                                            courseDivide.setTeamName(entry.getKey());//当前班级名称
                                            courseDivide.setCourseEnName(tCourseEnName);//当前学科英文名称
                                            courseDivide.setCourseChName(chName);//当前学科中文名称
                                            courseDivide.setCourseDivide(si);// 当前学科总分一分段分值
                                            courseDivide.setTotalCourseStudentNumber(totalStudentNumber);// 总人数
                                            courseDivide.setTeamCourseStudentNumber(entry.getValue());// 当前班级当前学科的人数
                                            // 当前分数si对应的统计记录存入列表totalDivideList
                                            courseDivideList.add(courseDivide);
                                        } // end of 遍历"班级学生映射 teamStudentMap“
                                    } // end of if (totalStudentNumber>0"
                                } //end of 遍历分数段
                                break;
                            }
                            case "physics":{
                                Collections.sort(scoreList, new Comparator<Score>() {
                                    @Override
                                    public int compare(Score o1, Score o2) {
                                        return Math.round(o2.getPhysics())-Math.round(o1.getPhysics()); //降序排列
                                    }
                                });
                                float maxScore=scoreList.get(0).getPhysics();//本次考试的物理最高分
                                // 查找当前成绩的最小值，忽略掉"0"分
                                float minScore=0;//本次考试的物理最低分
                                for(int ti=scoreList.size()-1;ti>=0;ti--){
                                    float t=scoreList.get(ti).getPhysics();
                                    if (t>0) {minScore=t;break;}
                                }
                                for (int si=Math.round(maxScore);si>=minScore;si--) { //si:第i种分数,只存储总分学生人数非零的记录
                                    Integer totalStudentNumber=0;//年级总分一分段总学生人数初始化为0
                                    Map<String,Integer> teamStudentMap=new HashMap<>();//(<班级名称>,<学科总分一分段学生人数>)初始化为0
                                    for (int ti=0;ti<teamList.size();ti++){//
                                        teamStudentMap.put(teamList.get(ti),0);
                                    }

                                    for (int j=0;j<scoreList.size();j++){//遍历成绩列表，（物理成绩已经降序排序）
                                        float tsj=scoreList.get(j).getPhysics();//第j个学生的物理成绩
                                        if (tsj>=si){
                                            totalStudentNumber++; //当前分值的总人数加1
                                            Integer tTeamStudentNumber=teamStudentMap.get(scoreList.get(j).getTeamName());// 从Map取值
                                            tTeamStudentNumber++;// 当前分值，当前班级的学生总人数加1
                                            teamStudentMap.put(scoreList.get(j).getTeamName(),tTeamStudentNumber);//值存入Map
                                        }
                                        if (tsj<si) break;// 因为物理成绩降序排列，后面的成绩记录不用找了。
                                    }// end of 遍历成绩列表
                                    if (totalStudentNumber>0){ //当前成绩si对应的总人数有,才分班级存储
                                        for (Map.Entry<String,Integer> entry:teamStudentMap.entrySet()){
                                            CourseDivide courseDivide=new CourseDivide(); // 存储当前班级学科一分段的信息
                                            courseDivide.setSemesterName(semesterName);
                                            courseDivide.setGradeName(gradeName);
                                            courseDivide.setExamName(examName);
                                            courseDivide.setCategoryName(categoryName);
                                            courseDivide.setTeamName(entry.getKey());//当前班级名称
                                            courseDivide.setCourseEnName(tCourseEnName);//当前学科英文名称
                                            courseDivide.setCourseChName(chName);//当前学科中文名称
                                            courseDivide.setCourseDivide(si);// 当前学科总分一分段分值
                                            courseDivide.setTotalCourseStudentNumber(totalStudentNumber);// 总人数
                                            courseDivide.setTeamCourseStudentNumber(entry.getValue());// 当前班级当前学科的人数
                                            // 当前分数si对应的统计记录存入列表totalDivideList
                                            courseDivideList.add(courseDivide);
                                        } // end of 遍历"班级学生映射 teamStudentMap“
                                    } // end of if (totalStudentNumber>0"
                                } //end of 遍历分数段
                                break;
                            }
                            case "history":{
                                Collections.sort(scoreList, new Comparator<Score>() {
                                    @Override
                                    public int compare(Score o1, Score o2) {
                                        return Math.round(o2.getHistory())-Math.round(o1.getHistory()); //降序排列
                                    }
                                });
                                float maxScore=scoreList.get(0).getHistory();//本次考试的历史最高分
                                // 查找当前成绩的最小值，忽略掉"0"分
                                float minScore=0;//本次考试的历史最低分
                                for(int ti=scoreList.size()-1;ti>=0;ti--){
                                    float t=scoreList.get(ti).getHistory();
                                    if (t>0) {minScore=t;break;}
                                }
                                for (int si=Math.round(maxScore);si>=minScore;si--) { //si:第i种分数,只存储总分学生人数非零的记录
                                    Integer totalStudentNumber=0;//年级总分一分段总学生人数初始化为0
                                    Map<String,Integer> teamStudentMap=new HashMap<>();//(<班级名称>,<学科总分一分段学生人数>)初始化为0
                                    for (int ti=0;ti<teamList.size();ti++){//
                                        teamStudentMap.put(teamList.get(ti),0);
                                    }
                                    for (int j=0;j<scoreList.size();j++){//遍历成绩列表，（历史成绩已经降序排序）
                                        float tsj=scoreList.get(j).getHistory();//第j个学生的历史成绩
                                        if (tsj>=si){
                                            totalStudentNumber++; //当前分值的总人数加1
                                            Integer tTeamStudentNumber=teamStudentMap.get(scoreList.get(j).getTeamName());// 从Map取值
                                            tTeamStudentNumber++;// 当前分值，当前班级的学生总人数加1
                                            teamStudentMap.put(scoreList.get(j).getTeamName(),tTeamStudentNumber);//值存入Map
                                        }
                                        if (tsj<si) break;// 因为历史成绩降序排列，后面的成绩记录不用找了。
                                    }// end of 遍历成绩列表
                                    if (totalStudentNumber>0){ //当前成绩si对应的总人数有,才分班级存储
                                        for (Map.Entry<String,Integer> entry:teamStudentMap.entrySet()){
                                            CourseDivide courseDivide=new CourseDivide(); // 存储当前班级学科一分段的信息
                                            courseDivide.setSemesterName(semesterName);
                                            courseDivide.setGradeName(gradeName);
                                            courseDivide.setExamName(examName);
                                            courseDivide.setCategoryName(categoryName);
                                            courseDivide.setTeamName(entry.getKey());//当前班级名称
                                            courseDivide.setCourseEnName(tCourseEnName);//当前学科英文名称
                                            courseDivide.setCourseChName(chName);//当前学科中文名称
                                            courseDivide.setCourseDivide(si);// 当前学科总分一分段分值
                                            courseDivide.setTotalCourseStudentNumber(totalStudentNumber);// 总人数
                                            courseDivide.setTeamCourseStudentNumber(entry.getValue());// 当前班级当前学科的人数
                                            // 当前分数si对应的统计记录存入列表totalDivideList
                                            courseDivideList.add(courseDivide);
                                        } // end of 遍历"班级学生映射 teamStudentMap“
                                    } // end of if (totalStudentNumber>0"
                                } //end of 遍历分数段
                                break;
                            }
                            case "chemistry":{
                                Collections.sort(scoreList, new Comparator<Score>() {
                                    @Override
                                    public int compare(Score o1, Score o2) {
                                        return Math.round(o2.getChemistry())-Math.round(o1.getChemistry()); //降序排列
                                    }
                                });
                                float maxScore=scoreList.get(0).getChemistry();//本次考试的化学最高分
                                // 查找当前成绩的最小值，忽略掉"0"分
                                float minScore=0;//本次考试的化学最低分
                                for(int ti=scoreList.size()-1;ti>=0;ti--){
                                    float t=scoreList.get(ti).getChemistry();
                                    if (t>0) {minScore=t;break;}
                                }
                                for (int si=Math.round(maxScore);si>=minScore;si--) { //si:第i种分数,只存储总分学生人数非零的记录
                                    Integer totalStudentNumber=0;//年级总分一分段总学生人数初始化为0
                                    Map<String,Integer> teamStudentMap=new HashMap<>();//(<班级名称>,<学科总分一分段学生人数>)初始化为0
                                    for (int ti=0;ti<teamList.size();ti++){//
                                        teamStudentMap.put(teamList.get(ti),0);
                                    }

                                    for (int j=0;j<scoreList.size();j++){//遍历成绩列表，（化学成绩已经降序排序）
                                        float tsj=scoreList.get(j).getChemistry();//第j个学生的化学成绩
                                        if (tsj>=si){
                                            totalStudentNumber++; //当前分值的总人数加1
                                            Integer tTeamStudentNumber=teamStudentMap.get(scoreList.get(j).getTeamName());// 从Map取值
                                            tTeamStudentNumber++;// 当前分值，当前班级的学生总人数加1
                                            teamStudentMap.put(scoreList.get(j).getTeamName(),tTeamStudentNumber);//值存入Map
                                        }
                                        if (tsj<si) break;// 因为化学成绩降序排列，后面的成绩记录不用找了。
                                    }// end of 遍历成绩列表
                                    if (totalStudentNumber>0){ //当前成绩si对应的总人数有,才分班级存储
                                        for (Map.Entry<String,Integer> entry:teamStudentMap.entrySet()){
                                            CourseDivide courseDivide=new CourseDivide(); // 存储当前班级学科一分段的信息
                                            courseDivide.setSemesterName(semesterName);
                                            courseDivide.setGradeName(gradeName);
                                            courseDivide.setExamName(examName);
                                            courseDivide.setCategoryName(categoryName);
                                            courseDivide.setTeamName(entry.getKey());//当前班级名称
                                            courseDivide.setCourseEnName(tCourseEnName);//当前学科英文名称
                                            courseDivide.setCourseChName(chName);//当前学科中文名称
                                            courseDivide.setCourseDivide(si);// 当前学科总分一分段分值
                                            courseDivide.setTotalCourseStudentNumber(totalStudentNumber);// 总人数
                                            courseDivide.setTeamCourseStudentNumber(entry.getValue());// 当前班级当前学科的人数
                                            // 当前分数si对应的统计记录存入列表totalDivideList
                                            courseDivideList.add(courseDivide);
                                        } // end of 遍历"班级学生映射 teamStudentMap“
                                    } // end of if (totalStudentNumber>0"
                                } //end of 遍历分数段
                                break;
                            }
                            case "biology":{
                                Collections.sort(scoreList, new Comparator<Score>() {
                                    @Override
                                    public int compare(Score o1, Score o2) {
                                        return Math.round(o2.getBiology())-Math.round(o1.getBiology()); //降序排列
                                    }
                                });
                                float maxScore=scoreList.get(0).getBiology();//本次考试的生物最高分
                                // 查找当前成绩的最小值，忽略掉"0"分
                                float minScore=0;//本次考试的生物最低分
                                for(int ti=scoreList.size()-1;ti>=0;ti--){
                                    float t=scoreList.get(ti).getBiology();
                                    if (t>0) {minScore=t;break;}
                                }
                                for (int si=Math.round(maxScore);si>=minScore;si--) { //si:第i种分数,只存储总分学生人数非零的记录
                                    Integer totalStudentNumber=0;//年级总分一分段总学生人数初始化为0
                                    Map<String,Integer> teamStudentMap=new HashMap<>();//(<班级名称>,<学科总分一分段学生人数>)初始化为0
                                    for (int ti=0;ti<teamList.size();ti++){//
                                        teamStudentMap.put(teamList.get(ti),0);
                                    }

                                    for (int j=0;j<scoreList.size();j++){//遍历成绩列表，（生物成绩已经降序排序）
                                        float tsj=scoreList.get(j).getBiology();//第j个学生的生物成绩
                                        if (tsj>=si){
                                            totalStudentNumber++; //当前分值的总人数加1
                                            Integer tTeamStudentNumber=teamStudentMap.get(scoreList.get(j).getTeamName());// 从Map取值
                                            tTeamStudentNumber++;// 当前分值，当前班级的学生总人数加1
                                            teamStudentMap.put(scoreList.get(j).getTeamName(),tTeamStudentNumber);//值存入Map
                                        }
                                        if (tsj<si) break;// 因为生物成绩降序排列，后面的成绩记录不用找了。
                                    }// end of 遍历成绩列表
                                    if (totalStudentNumber>0){ //当前成绩si对应的总人数有,才分班级存储
                                        for (Map.Entry<String,Integer> entry:teamStudentMap.entrySet()){
                                            CourseDivide courseDivide=new CourseDivide(); // 存储当前班级学科一分段的信息
                                            courseDivide.setSemesterName(semesterName);
                                            courseDivide.setGradeName(gradeName);
                                            courseDivide.setExamName(examName);
                                            courseDivide.setCategoryName(categoryName);
                                            courseDivide.setTeamName(entry.getKey());//当前班级名称
                                            courseDivide.setCourseEnName(tCourseEnName);//当前学科英文名称
                                            courseDivide.setCourseChName(chName);//当前学科中文名称
                                            courseDivide.setCourseDivide(si);// 当前学科总分一分段分值
                                            courseDivide.setTotalCourseStudentNumber(totalStudentNumber);// 总人数
                                            courseDivide.setTeamCourseStudentNumber(entry.getValue());// 当前班级当前学科的人数
                                            // 当前分数si对应的统计记录存入列表totalDivideList
                                            courseDivideList.add(courseDivide);
                                        } // end of 遍历"班级学生映射 teamStudentMap“
                                    } // end of if (totalStudentNumber>0"
                                } //end of 遍历分数段
                                break;
                            }
                            case "politics":{
                                Collections.sort(scoreList, new Comparator<Score>() {
                                    @Override
                                    public int compare(Score o1, Score o2) {
                                        return Math.round(o2.getPolitics())-Math.round(o1.getPolitics()); //降序排列
                                    }
                                });
                                float maxScore=scoreList.get(0).getPolitics();//本次考试的政治最高分
                                // 查找当前成绩的最小值，忽略掉"0"分
                                float minScore=0;//本次考试的政治最低分
                                for(int ti=scoreList.size()-1;ti>=0;ti--){
                                    float t=scoreList.get(ti).getPolitics();
                                    if (t>0) {minScore=t;break;}
                                }
                                for (int si=Math.round(maxScore);si>=minScore;si--) { //si:第i种分数,只存储总分学生人数非零的记录
                                    Integer totalStudentNumber=0;//年级总分一分段总学生人数初始化为0
                                    Map<String,Integer> teamStudentMap=new HashMap<>();//(<班级名称>,<学科总分一分段学生人数>)初始化为0
                                    for (int ti=0;ti<teamList.size();ti++){//
                                        teamStudentMap.put(teamList.get(ti),0);
                                    }

                                    for (int j=0;j<scoreList.size();j++){//遍历成绩列表，（政治成绩已经降序排序）
                                        float tsj=scoreList.get(j).getPolitics();//第j个学生的政治成绩
                                        if (tsj>=si){
                                            totalStudentNumber++; //当前分值的总人数加1
                                            Integer tTeamStudentNumber=teamStudentMap.get(scoreList.get(j).getTeamName());// 从Map取值
                                            tTeamStudentNumber++;// 当前分值，当前班级的学生总人数加1
                                            teamStudentMap.put(scoreList.get(j).getTeamName(),tTeamStudentNumber);//值存入Map
                                        }
                                        if (tsj<si) break;// 因为政治成绩降序排列，后面的成绩记录不用找了。
                                    }// end of 遍历成绩列表
                                    if (totalStudentNumber>0){ //当前成绩si对应的总人数有,才分班级存储
                                        for (Map.Entry<String,Integer> entry:teamStudentMap.entrySet()){
                                            CourseDivide courseDivide=new CourseDivide(); // 存储当前班级学科一分段的信息
                                            courseDivide.setSemesterName(semesterName);
                                            courseDivide.setGradeName(gradeName);
                                            courseDivide.setExamName(examName);
                                            courseDivide.setCategoryName(categoryName);
                                            courseDivide.setTeamName(entry.getKey());//当前班级名称
                                            courseDivide.setCourseEnName(tCourseEnName);//当前学科英文名称
                                            courseDivide.setCourseChName(chName);//当前学科中文名称
                                            courseDivide.setCourseDivide(si);// 当前学科总分一分段分值
                                            courseDivide.setTotalCourseStudentNumber(totalStudentNumber);// 总人数
                                            courseDivide.setTeamCourseStudentNumber(entry.getValue());// 当前班级当前学科的人数
                                            // 当前分数si对应的统计记录存入列表totalDivideList
                                            courseDivideList.add(courseDivide);
                                        } // end of 遍历"班级学生映射 teamStudentMap“
                                    } // end of if (totalStudentNumber>0"
                                } //end of 遍历分数段
                                break;
                            }
                            case "geography":{
                                Collections.sort(scoreList, new Comparator<Score>() {
                                    @Override
                                    public int compare(Score o1, Score o2) {
                                        return Math.round(o2.getGeography())-Math.round(o1.getGeography()); //降序排列
                                    }
                                });
                                float maxScore=scoreList.get(0).getGeography();//本次考试的地理最高分
                                // 查找当前成绩的最小值，忽略掉"0"分
                                float minScore=0;//本次考试的地理最低分
                                for(int ti=scoreList.size()-1;ti>=0;ti--){
                                    float t=scoreList.get(ti).getGeography();
                                    if (t>0) {minScore=t;break;}
                                }
                                for (int si=Math.round(maxScore);si>=minScore;si--) { //si:第i种分数,只存储总分学生人数非零的记录
                                    Integer totalStudentNumber=0;//年级总分一分段总学生人数初始化为0
                                    Map<String,Integer> teamStudentMap=new HashMap<>();//(<班级名称>,<学科总分一分段学生人数>)初始化为0
                                    for (int ti=0;ti<teamList.size();ti++){//
                                        teamStudentMap.put(teamList.get(ti),0);
                                    }
                                    for (int j=0;j<scoreList.size();j++){//遍历成绩列表，（地理成绩已经降序排序）
                                        float tsj=scoreList.get(j).getGeography();//第j个学生的地理成绩
                                        if (tsj>=si){
                                            totalStudentNumber++; //当前分值的总人数加1
                                            Integer tTeamStudentNumber=teamStudentMap.get(scoreList.get(j).getTeamName());// 从Map取值
                                            tTeamStudentNumber++;// 当前分值，当前班级的学生总人数加1
                                            teamStudentMap.put(scoreList.get(j).getTeamName(),tTeamStudentNumber);//值存入Map
                                        }
                                        if (tsj<si) break;// 因为地理成绩降序排列，后面的成绩记录不用找了。
                                    }// end of 遍历成绩列表
                                    if (totalStudentNumber>0){ //当前成绩si对应的总人数有,才分班级存储
                                        for (Map.Entry<String,Integer> entry:teamStudentMap.entrySet()){
                                            CourseDivide courseDivide=new CourseDivide(); // 存储当前班级学科一分段的信息
                                            courseDivide.setSemesterName(semesterName);
                                            courseDivide.setGradeName(gradeName);
                                            courseDivide.setExamName(examName);
                                            courseDivide.setCategoryName(categoryName);
                                            courseDivide.setTeamName(entry.getKey());//当前班级名称
                                            courseDivide.setCourseEnName(tCourseEnName);//当前学科英文名称
                                            courseDivide.setCourseChName(chName);//当前学科中文名称
                                            courseDivide.setCourseDivide(si);// 当前学科总分一分段分值
                                            courseDivide.setTotalCourseStudentNumber(totalStudentNumber);// 总人数
                                            courseDivide.setTeamCourseStudentNumber(entry.getValue());// 当前班级当前学科的人数
                                            // 当前分数si对应的统计记录存入列表totalDivideList
                                            courseDivideList.add(courseDivide);
                                        } // end of 遍历"班级学生映射 teamStudentMap“
                                    } // end of if (totalStudentNumber>0"
                                } //end of 遍历分数段
                                break;
                            }
                            case "sports":{
                                Collections.sort(scoreList, new Comparator<Score>() {
                                    @Override
                                    public int compare(Score o1, Score o2) {
                                        return Math.round(o2.getSports())-Math.round(o1.getSports()); //降序排列
                                    }
                                });
                                float maxScore=scoreList.get(0).getSports();//本次考试的体育最高分
                                // 查找当前成绩的最小值，忽略掉"0"分
                                float minScore=0;//本次考试的体育最低分
                                for(int ti=scoreList.size()-1;ti>=0;ti--){
                                    float t=scoreList.get(ti).getSports();
                                    if (t>0) {minScore=t;break;}
                                }
                                for (int si=Math.round(maxScore);si>=minScore;si--) { //si:第i种分数,只存储总分学生人数非零的记录
                                    Integer totalStudentNumber=0;//年级总分一分段总学生人数初始化为0
                                    Map<String,Integer> teamStudentMap=new HashMap<>();//(<班级名称>,<学科总分一分段学生人数>)初始化为0
                                    for (int ti=0;ti<teamList.size();ti++){//
                                        teamStudentMap.put(teamList.get(ti),0);
                                    }

                                    for (int j=0;j<scoreList.size();j++){//遍历成绩列表，（体育成绩已经降序排序）
                                        float tsj=scoreList.get(j).getSports();//第j个学生的体育成绩
                                        if (tsj>=si){
                                            totalStudentNumber++; //当前分值的总人数加1
                                            Integer tTeamStudentNumber=teamStudentMap.get(scoreList.get(j).getTeamName());// 从Map取值
                                            tTeamStudentNumber++;// 当前分值，当前班级的学生总人数加1
                                            teamStudentMap.put(scoreList.get(j).getTeamName(),tTeamStudentNumber);//值存入Map
                                        }
                                        if (tsj<si) break;// 因为体育成绩降序排列，后面的成绩记录不用找了。
                                    }// end of 遍历成绩列表
                                    if (totalStudentNumber>0){ //当前成绩si对应的总人数有,才分班级存储
                                        for (Map.Entry<String,Integer> entry:teamStudentMap.entrySet()){
                                            CourseDivide courseDivide=new CourseDivide(); // 存储当前班级学科一分段的信息
                                            courseDivide.setSemesterName(semesterName);
                                            courseDivide.setGradeName(gradeName);
                                            courseDivide.setExamName(examName);
                                            courseDivide.setCategoryName(categoryName);
                                            courseDivide.setTeamName(entry.getKey());//当前班级名称
                                            courseDivide.setCourseEnName(tCourseEnName);//当前学科英文名称
                                            courseDivide.setCourseChName(chName);//当前学科中文名称
                                            courseDivide.setCourseDivide(si);// 当前学科总分一分段分值
                                            courseDivide.setTotalCourseStudentNumber(totalStudentNumber);// 总人数
                                            courseDivide.setTeamCourseStudentNumber(entry.getValue());// 当前班级当前学科的人数
                                            // 当前分数si对应的统计记录存入列表totalDivideList
                                            courseDivideList.add(courseDivide);
                                        } // end of 遍历"班级学生映射 teamStudentMap“
                                    } // end of if (totalStudentNumber>0"
                                } //end of 遍历分数段
                                break;
                            }
                        }
                    } // end of 遍历学科
                    // totalDivideList存入“总分一分段表t_total_divide”
                    courseDivideService.batchInsert(courseDivideList);
                    break;
                }//end of "学科一分段表t_course_divide" **测试通过** (利用了scoreList的结果，反复根据“学科成绩”降序排序)

                // .....添加更多的统计项目

                } // end of ”分类统计statisticsTableName“

                // 公共部分：单条统计记录存入t_statistics_finished表。
                StatisticsFinished sf = new StatisticsFinished();
                String statisticsName = statisticsService.getStatisticsNameByParam(statisticsTableName);
                sf.setStatisticsName(statisticsName);
                sf.setStatisticsTableName(statisticsTableName);
                sf.setSemesterName(semesterName);
                sf.setGradeName(gradeName);
                sf.setGradeDatatableName(gradeDatatableName);
                sf.setExamName(examName);
                sf.setCategoryName(categoryName);
                SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                sf.setStatisticsDate(df.format(new Date()));
                statisticsFinishedService.insert(sf); // **测试通过return "统计成功";

                res.put("success","success");
                res.put("msg","统计成功");
                return res;
            }
            else {
                if (scoreList.size()<=0){
                res.put("failed","failed");
                res.put("msg","没有查找到学生成绩信息，没有生成统计记录。请先导入本次考试的学生成绩，再进行统计。");
                return res;
                } else {
                    res.put("failed","failed");
                    res.put("msg","没有查找到统计参数，没有生成统计记录。请先导入本次考试的统计参数，再进行统计。");
                    return res;
                }
                } //end of "scoreList.size()>0&&statisticsParamiter.getExamName().length()>0"
        }//end of else
    } // end of "scoreStatistics"
} // end of "scoreController"